Jump to content

Pause pixi scene?


Recommended Posts

Hey All,


I am doing a simple 2d animation using pixi for a website... it's not interactive, it just uses the MovieClip feature and some simple rotation and position animations.


I want to know if there's a way to "pause" all animations. If the user scrolls past the the area of the website where the canvas is or if they click on another tab (single page app style) I want to pause the animation so that it's not impacting the site's performance.  I found that I can do a ticker.stop() to pause the MovieClip animation, but this does not stop the frame by frame animate() from running.


So, if I have some simple example like:


var renderer = PIXI.autoDetectRenderer(window.innerWidth, 500, {transparent: true});


var stage = new PIXI.Container();

var thing = new PIXI.Sprite.fromImage('/path/to/file.png');



function animate() {

 thing.rotation = 0.1;



how do I pause the animation so that pixijs is not running and the canvas shows a still image of the non-animating 'thing'.



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...