hrgdavor/jscadui

[animation] Animation display always 1 step behind on fps update

Opened this issue · 1 comments

When animation is halted, changing fps updates slider immediately to next position, but the number in Animation text field does not get updated immediately. Starting with fps=2 at slider position 0.5, going to fps=3 moves slider to 0.666, but keeps 0.5 in Animation.
Going to fps=4 moves slider to 0.75 and updates Animation to 0.666, the value before.
So Animation display is always 1 fps update behind.

I made some improvements to animation runner to better follow step values for given fps.

and also took a look at the mentioned issue. You are right, but to fixit a different issue happens. So I decided to write in console what happened
image

Animation stopped between generating frame for t=7 and rendering it. Discarding the result.

If I allow it to render anyway, for very slow animation like 1 fps, you would press stop animation at step 7 but it would stop at step=8.

The issue is that I request render of a frame right away, and then wait for rendering it to match chosen fps. for very fast scripts and 1 fps result is returned in few ms, and then anim waits 999 ms to render the frame.

To me it is worse if animation does not stop when I click it to stop, than a bit of confusion seing script is called for a t=# but that last result is not on the screen.