Actuate tween error in inactive browser tab

I using openfl/ starling framework and animating with actuate. animation is looping like
Tween function > On Complete > Tween function again and etc.
when my browser tab is inactive tween goes crazy…
is there any solution for that?

1 Like

Is there anything we can use to reproduce this? I have not seen trouble in PiratePig or other demos

see this please.
i dont know its maybe browser is pausing and continuing or something.
on the second try animation goes far above and then to its regular position…

is there any way javascript not to be paused when tab is inactive?

Why should it? This behaviour is managed manually –

because code doesnt stop just tweens are paused and then when tab is active again all the tweens runs at the same time just like in this video

Probably related –

Timeouts in inactive tabs throttled to >=1000ms

To reduce the load (and associated battery usage) from background tabs, timeouts are throttled to firing no more often than once per second (1000 ms) in inactive tabs.

Firefox implements this behavior since version 5 (see bug 633421, the 1000ms constant can be tweaked through the dom.min_background_timeout_value preference). Chrome implements this behavior since version 11 (

Firefox for Android uses a timeout value of 15 minutes for background tabs since bug 736602in Firefox 14, and background tabs can also be unloaded entirely.

So, if animation tick is bound to interval, then it should be reimplemented with requestAnimationFrame (I believe it is not affected).
Also you could pause/resume animations on visibility change event.

1 Like

you are right the main problem for me in this case is that onUpdate function isnt working when tab is inactive

So i made VisibilityChange event and if tab is not active pause all the tweens and timers and resume when tab is active. all good!

1 Like