Members
-
Whether or not this ticker should invoke the method PIXI.ticker.Ticker#start automatically when a listener is added.
- Default Value:
- false
-
Scalar time value from last frame to this frame. This value is capped by setting PIXI.ticker.Ticker#minFPS and is scaled with PIXI.ticker.Ticker#speed. Note: The cap may be exceeded by scaling.
- Default Value:
- 1
-
Time elapsed in milliseconds from last frame to this frame. Opposed to what the scalar PIXI.ticker.Ticker#deltaTime is based, this value is neither capped nor scaled. If the platform supports DOMHighResTimeStamp, this value will have a precision of 1 µs. Defaults to target frame time
- Default Value:
- 16.66
-
The frames per second at which this ticker is running. The default is approximately 60 in most modern browsers. Note: This does not factor in the value of PIXI.ticker.Ticker#speed, which is specific to scaling PIXI.ticker.Ticker#deltaTime.
-
The last time PIXI.ticker.Ticker#update was invoked. This value is also reset internally outside of invoking update, but only when a new animation frame is requested. If the platform supports DOMHighResTimeStamp, this value will have a precision of 1 µs.
- Default Value:
- -1
-
Manages the maximum amount of milliseconds allowed to elapse between invoking PIXI.ticker.Ticker#update. This value is used to cap PIXI.ticker.Ticker#deltaTime, but does not effect the measured value of PIXI.ticker.Ticker#FPS. When setting this property it is clamped to a value between
0
andPIXI.settings.TARGET_FPMS * 1000
.- Default Value:
- 10
-
Factor of current PIXI.ticker.Ticker#deltaTime.
- Default Value:
- 1
Example
// Scales ticker.deltaTime to what would be // the equivalent of approximately 120 FPS ticker.speed = 2;
-
Whether or not this ticker has been started.
true
if PIXI.ticker.Ticker#start has been called.false
if PIXI.ticker.Ticker#stop has been called. Whilefalse
, this value may change totrue
in the event of PIXI.ticker.Ticker#autoStart beingtrue
and a listener is added.- Default Value:
- false
Methods
-
add (fn, context, priority)PIXI.ticker.Ticker
-
Register a handler for tick events. Calls continuously unless it is removed or the ticker is stopped.
Name Type Default Description fn
function The listener function to be added for updates
context
function optional The listener context
priority
number PIXI.UPDATE_PRIORITY.NORMAL optional The priority for emitting
Returns:
Type Description PIXI.ticker.Ticker This instance of a ticker -
addOnce (fn, context, priority)PIXI.ticker.Ticker
-
Add a handler for the tick event which is only execute once.
Name Type Default Description fn
function The listener function to be added for one update
context
function optional The listener context
priority
number PIXI.UPDATE_PRIORITY.NORMAL optional The priority for emitting
Returns:
Type Description PIXI.ticker.Ticker This instance of a ticker -
Destroy the ticker and don't use after this. Calling this method removes all references to internal events.
-
remove (fn, context)PIXI.ticker.Ticker
-
Removes any handlers matching the function and context parameters. If no handlers are left after removing, then it cancels the animation frame.
Name Type Description fn
function 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.
-
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