Sign in to follow this  

ticker example

Recommended Posts

Here's an super basic example of using the shared one wrapped up using an ES6 style class.

class TickManager {
	constructor( settings ) {
		PIXI.ticker.shared.add( this._onTickEvent, this );

	destroy() {
		PIXI.ticker.shared.remove( this._onTickEvent, this );
	_onTickEvent( deltaTime ) {
		console.log( deltaTime );

It's a replacement for requestAnimationFrame for my usage. That way if I want to pause the game, I can just stop the timer. If for debug reasons I want to speed up / slow down the game, I can do it on the timer, instead of manipulating a rAF calls. And the positives of it being based on rAF is that if you minimise the browser, the timer is essentially paused until you maximise it again.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.