canvas - TweenJS using requestAnimationFrame pauses on tab switch -


i use createjs.tweenjs twining objects on canvas game. problem when switch tab, tween pauses , continues process after tabs focused back.

my goal show stage state on current time situation, when tab focused back. if in different way, when switch tab, processes mustn't pause, run in background.

if switch tweenjs timing mode timeout instead of requestanimationframe (raf), works well.

is possible achieve same result using requestanimationframe timing mode?

this 1 of features of raf. has non-deterministic frequency, , allows browser throttle or pause background animations prevent hidden content burning cpu , battery. it's managed browser, , have no control on it.

if recall correctly, browsers (ex. safari) throttle timeout events extent.

take @ page visibility api, available in modern browsers, , should able track elapsed time between when tab hidden when shown, , react accordingly.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -