Ticker
Index
Constructors
constructor
Parameters
tickFunction: () => void
Function to be called on each tick.
tickRate: number = 60
Number of ticks per second.
maxAccumulation: number = 25
Maximum number of milliseconds that can be accumulated.
startImmediately: boolean = true
Whether to start the ticker immediately.
Returns Ticker
Accessors
accumulator
Current accumulated frame time, in milliseconds.
Returns number
deltaTime
Fixed time between ticks, in seconds.
Returns number
deltaTimeMs
Fixed time between ticks, in milliseconds.
Returns number
isRunning
Whether the ticker is running.
Returns boolean
isStopped
Whether the ticker is stopped.
Returns boolean
maxAccumulation
Maximum number of milliseconds that can be accumulated in a single tick.
Returns number
realtimeSinceStartup
Time since the ticker started, in seconds.
Returns number
realtimeSinceStartupMs
Time since the ticker started, in milliseconds.
Returns number
tickNumber
Current tick number. Increased by 1 every time tick() gets called.
Returns number
Methods
getHighResolutionTime
Returns the current time in milliseconds. High-res if supported.
Returns number
Current time in milliseconds.
setMaxAccumulation
Sets the maximum number of milliseconds that can be accumulated in one frame.
Parameters
maxAccumulation: number
Maximum number of milliseconds that can be accumulated.
Returns void
setTickNumber
Sets the current tick number.
Parameters
tickNumber: number
Tick number.
Returns void
setTickRate
How many times a second should we tick?
Parameters
ticksPerSecond: number
Number of ticks per second.
Returns void
start
Starts the ticker.
Returns void
stop
Stops the ticker.
Returns void
Creates a new Ticker.