Abstracts away the use of RAF or setTimeOut for the core game update loop. This is invoked automatically by the Phaser.Game instance.
new RequestAnimationFrame()
The callback to be invoked each step.
True if RequestAnimationFrame is running, otherwise false.
True if the step is using setTimeout instead of RAF.
The previous time the step was called.
The RAF step function. Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame.
The SetTimeout step function. Updates the local tick value, invokes the callback and schedules another call to setTimeout.
The target FPS rate in ms. Only used when setTimeout is used instead of RAF.
The most recent timestamp. Either a DOMHighResTimeStamp under RAF or Date.now
under SetTimeout.
The setTimeout or RAF callback ID used when canceling them.
Stops the step from running and clears the callback reference.
Starts the requestAnimationFrame or setTimeout process running.
name | type | description |
---|---|---|
callback | FrameRequestCallback |
The callback to invoke each step. |
forceSetTimeOut | boolean |
Should it use SetTimeout, even if RAF is available? |
targetFPS | number |
The target fps rate (in ms). Only used when setTimeout is used. |
Stops the requestAnimationFrame or setTimeout from running.