Jump to content

Updating shared ticker in inactive tab


Recommended Posts

I have a problem with AnimatedSprite in inactive tab. If you leave the tab after the start of the animation (goToAndPlay()), the event onComplete() does not work. Why is this happening?

I try update shared ticker by setInterval()

this.app = new PIXI.Application({
    sharedTicker : true,
    autoStart: false,

this.tickerInterval = null;

// Events:
this.emitter.on('window-focus', () => {
    this.tickerInterval && clearInterval(this.tickerInterval);
}).on('window-blur', function(){
    this.tickerInterval = setInterval(function(){
        this.app.ticker.update(new Date().getTime());
    }, 30);


Link to comment
Share on other sites

Another relevant place: https://github.com/pixijs/pixi.js/blob/dev/packages/ticker/src/Ticker.js#L390

Also I dont recomment setting up that small interval on blur. 400ms shoulkd be enough, and i dont think we need to render stage. maybe only call updateTransform()  on it. Dont forget temp parent or ask updateTransform on stage children but not on stage itself or it'll crash with nullpointer. Yeah, i know, its stupid.

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