Jump to content

Keep rendering while tab is hidden


Recommended Posts

I am making a simple game using pixijs and have problem that animation stops when I hide the browser window and after showing the window the animation continutes from where it stopped. I simply need to keep animation going even in background.
I use "app.ticker.add(loop);"
and "loop" is a function where all the animation happens.
Thank you

Link to comment
Share on other sites

The ticker class within pixi is based upon request animation frame, and that gets paused automatically by the browser when on another tab for efficiency reasons (why have a background tab eating up resources). There's nothing you can do to get around this... you could try animating based off your own version of a ticker that's say, based on setTimeout, but bear in mind it'll still get throttled in the background by most browsers, but at least it'll still run

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.

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.


  • Recently Browsing   0 members

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