new AnimationTimer(callback)
Animation timer should be used to run the update and render loops of the application.
Underneat it uses the requestAnimationFrame() method that calls the function with the same rate as the screen refresh rate.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Timer callback function. |
- Source:
Members
callback :function
Task of the timer, executed at the timer defined rate.
Type:
- function
- Source:
id :number
ID of the currently waiting timeout clock. Used to cancel the already request execution of the next clock tick.
Type:
- number
- Source:
running :boolean
Indicates if the timer is currently running, it is set to true on start and reset to false on stop.
Type:
- boolean
- Source:
Methods
start()
Start timer, is the timer is already running does not do anything.
- Source:
stop()
Stop animation timer, should be called when the render loop is no longer in use to prevent code/memory leaks.
If the timer is not stopped the loop will keep running using processing power and consuming memory.
- Source: