Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Updating shared ticker in inactive tab

$
0
0

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);
});

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>