jiroler Posted March 24, 2019 Share Posted March 24, 2019 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.app.ticker.start(); this.tickerInterval = null; // Events: //... this.emitter.on('window-focus', () => { this.tickerInterval && clearInterval(this.tickerInterval); this.app.ticker.start() }).on('window-blur', function(){ this.app.ticker.stop(); this.tickerInterval = setInterval(function(){ this.app.ticker.update(new Date().getTime()); this.app.renderer.render(this.app.stage); }, 30); }); ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 24, 2019 Share Posted March 24, 2019 Find the answer here: https://github.com/pixijs/pixi.js/blob/dev/packages/sprite-animated/src/AnimatedSprite.js#L219 I dont know too Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 24, 2019 Share Posted March 24, 2019 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. 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.