new Timer(onTick, expireMillis, onExpire)
A timer that calls callbacks while it is running, and when it expires.
Parameters:
Name | Type | Description |
---|---|---|
onTick |
simulationCallback | Called when the Timer is tick()ed |
expireMillis |
number | The number of milliseconds until the Timer expires |
onExpire |
emptyCallback | Called when the Timer expires |
Methods
expired() → {boolean}
Test if the Timer has expired.
Returns:
- Type
- boolean
reset()
Zeroes the timer.
This does not stop the Timer!
start()
Start the Timer running.
This does not reset the Timer!
stop()
Stop the Timer.
This does not reset the Timer!
tick(elapsedMillis)
Advance the Timer.
Normally Splat.Scene does this for you.
Parameters:
Name | Type | Description |
---|---|---|
elapsedMillis |
number | How many milliseconds to advance the timer. |