Class: Ticker

PIXI.ticker. Ticker

A Ticker class that runs an update loop that other objects listen to.
This class is composed around an EventEmitter object to add listeners
meant for execution on the next requested animation frame.
Animation frames are requested only when necessary,
e.g. When the ticker is started and the emitter has listeners.

new PIXI.ticker.Ticker()

Members

minFPS

Sets the min fps.

Methods

Calls module:eventemitter3.EventEmitter#on internally for the
internal 'tick' event. It checks if the emitter has listeners,
and if so it requests a new animation frame at this point.

Name Type Description
fn function

The listener function to be added for updates

context function optional

The listener context

Returns:
Type Description
PIXI.ticker.Ticker This instance of a ticker

Calls module:eventemitter3.EventEmitter#once internally for the
internal 'tick' event. It checks if the emitter has listeners,
and if so it requests a new animation frame at this point.

Name Type Description
fn function

The listener function to be added for one update

context function optional

The listener context

Returns:
Type Description
PIXI.ticker.Ticker This instance of a ticker

Calls module:eventemitter3.EventEmitter#off internally for 'tick' event.
It checks if the emitter has listeners for 'tick' event.
If it does, then it cancels the animation frame.

Name Type Description
fn function optional

The listener function to be removed

context function optional

The listener context to be removed

Returns:
Type Description
PIXI.ticker.Ticker This instance of a ticker

Starts the ticker. If the ticker has listeners
a new animation frame is requested at this point.

Stops the ticker. If the ticker has requested
an animation frame it is canceled at this point.

update(currentTime)

Triggers an update. An update entails setting the
current PIXI.ticker.Ticker#elapsedMS,
the current PIXI.ticker.Ticker#deltaTime,
invoking all listeners with current deltaTime,
and then finally setting PIXI.ticker.Ticker#lastTime
with the value of currentTime that was provided.
This method will be called automatically by animation
frame callbacks if the ticker instance has been started
and listeners are added.

Name Type Default Description
currentTime number performance.now() optional

the current time of execution