Figma "after delay" not exact?

So I was trying to make a simple timer that counts up seconds, minutes and so on.

I found this “Timer Animation” Community file which does exactly that:

However, I noticed on this (and the few other files/videos I found) that the timing of the seconds as soon as it becomes 2-digits (so starting at 10 seconds) is never quite right - the 1 always appears a bit too soon (so before the 9 becomes a 0).

I just wondered why that is? I believe the file is set up right with the correct ms for delay… So is the “after delay” interaction just not exact? So if you set 1000ms it’s just a bit short of that? Or am I missing something? Maths isn’t my strong suit :joy:

I’d love to hear your assumptions/knowledge/ideas :upside_down_face:

This is a common problem in all real-time graphics-intensive applications, mostly games. It depends on the engine / render loop implementation. In case of Figma, it probably works like this:

  1. 0ms: Frame 1 is rendered. The timer starts.
  2. 1000ms: Timer ends, Frame 2 starts rendering.
  3. … It takes several milliseconds to render the frame.
  4. 1200ms: Frame 2 is rendered. The new timer starts.
  5. 2200ms: Timer ends, Frame 3 starts rendering…

… etc. Every render loop the time it takes to render an image is taken into account of the timer. It takes a while to start a new timer. And since there is no mechanic in Figma to make a real loop, instead you create a new timer transition every time, so there is no way to take this delay of 200ms into account. (1000ms is 1 second)

1 Like

Ah, that makes sense! Thank you for the quick answer @Gleb :upside_down_face:

I wonder if there’s any way to set the time so you can take the render frames into consideration :thinking:

That would depend on the performance of the device. But you can always set the delay slightly shorter for numbers that change more often. Find the optimal number through experiments. Or abandon the idea of using transitions for this and create a GIF instead.

1 Like

Thanks a lot @Gleb - still sad it’s not working perfectly out of the box :sweat_smile: But yeah I just might leave it a bit wonky… Although the gif idea would be worth a shot just out of curiosity!

Thanks agan! :blush: