Akis Posted December 6, 2013 Share Posted December 6, 2013 Hi! What's the best practices about animations when the user doesn't have the focus inside the window?I know the window doesn't run at 60fps when it doesn't have the focus and this can create some weird behaviors. I tried 2 differents ways to animate elements and both have the same issue. The 2 ways are jQuery animate and GreenSock. I noticed that when the window doesn't have the focus, some of my animations are not triggered. (Dom animation for jquery and canvas animation for GreenSock. I didn't try dom anim with greensock). Did you noticed the same thing? How to fix it?I don't really understand that because even if the framerate is lower, you still have a frame, so an elapsed time, so the animation should still be there (at least the last state of the animation)... Thanks. Quote Link to comment Share on other sites More sharing options...
justinmc Posted December 14, 2013 Share Posted December 14, 2013 Can you give an example of an animation not being triggered? There are some interesting issues that can come up with this, I'm specifically thinking of using requestAnimationFrame in a game loop. I'm not familiar with how jQuery.animate behaves when the tab isn't active, but that could be interesting to dig into also. Quote Link to comment Share on other sites More sharing options...
Quetzacotl Posted December 15, 2013 Share Posted December 15, 2013 requestAnimationFrame doesn't run without focus. If you want your animation to work even without focus then you have to use setTimeout/Interval. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.