Members
-
Whether or not this ticker should invoke the method SINT.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 SINT.ticker.Ticker#minFPS and is scaled with SINT.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 SINT.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 SINT.ticker.Ticker#speed, which is specific to scaling SINT.ticker.Ticker#deltaTime.
-
The last time SINT.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 SINT.ticker.Ticker#update. This value is used to cap SINT.ticker.Ticker#deltaTime, but does not effect the measured value of SINT.ticker.Ticker#FPS. When setting this property it is clamped to a value between
0
andSINT.settings.TARGET_FPMS * 1000
.- Default Value:
- 10
-
Factor of current SINT.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 SINT.ticker.Ticker#start has been called.false
if SINT.ticker.Ticker#stop has been called. Whilefalse
, this value may change totrue
in the event of SINT.ticker.Ticker#autoStart beingtrue
and a listener is added.- Default Value:
- false
Methods
-
add (fn, context, priority)SINT.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 SINT.UPDATE_PRIORITY.NORMAL optional The priority for emitting
Returns:
Type Description SINT.ticker.Ticker This instance of a ticker -
addOnce (fn, context, priority)SINT.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 SINT.UPDATE_PRIORITY.NORMAL optional The priority for emitting
Returns:
Type Description SINT.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)SINT.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 SINT.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 SINT.ticker.Ticker#elapsedMS, the current SINT.ticker.Ticker#deltaTime, invoking all listeners with current deltaTime, and then finally setting SINT.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