Jump to content

Animation when window doesn't have the focus


Akis
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...