The time elapsed since timer initialization, in milliseconds.
The time after which timeElapsed will reset, in milliseconds.
By default, this is 1 hour.
If you use the timer for animations, you can set this to a period
that matches the animation durations.
This is necessary for the timer to avoid floating-point precision issues in shaders. A float32 can represent a few hours of milliseconds accurately, but the precision decreases as the value increases.
Whether the elapse timer is paused.
Reset the elapse timer for this game object.
Optionalms: numberThe time to reset the timer to. Default 0.
Pauses or resumes the elapse timer for this game object.
Optionalpaused: booleanPause state (true to pause, false to unpause). If not specified, the timer will unpause.
Set the reset period for the elapse timer for this game object.
The time after which timeElapsed will reset, in milliseconds.
Update the elapse timer for this game object. This should be called automatically by the preUpdate method.
Override this method to create more advanced time management, or set it to a NOOP function to disable the timer update. If you want to control animations with a tween or input system, disabling the timer update could be useful.
The current time in milliseconds.
The time since the last update, in milliseconds.
Provides methods for managing an elapse timer on a Game Object. The timer is used to drive animations and other time-based effects.
This is not necessary for normal animations. It is intended to drive shader effects that require a time value.
If you are adding this component to a Game Object, ensure that you register a preUpdate method on the Game Object, e.g.: