Phaser API Documentation

  Version: 
Filter

Abstracts away the use of RAF or setTimeOut for the core game update loop.

This is invoked automatically by the Phaser.Game instance.

Constructor:

new RequestAnimationFrame()
Since: 3.0.0

Members

callback: FrameRequestCallback
Focus
Focus

Description:

The callback to be invoked each step.

Type:
FrameRequestCallback
Since: 3.0.0
Focus
Focus
delay: number
Focus
Focus

Description:

The delay rate in ms for setTimeOut.

Type:
number
Default: 0
Since: 3.60.0
Focus
Focus
isRunning: boolean
Focus
Focus

Description:

True if RequestAnimationFrame is running, otherwise false.

Type:
boolean
Default: false
Since: 3.0.0
Focus
Focus
isSetTimeOut: boolean
Focus
Focus

Description:

True if the step is using setTimeout instead of RAF.

Type:
boolean
Default: false
Since: 3.0.0
Focus
Focus
step: FrameRequestCallback
Focus
Focus

Description:

The RAF step function.

Invokes the callback and schedules another call to requestAnimationFrame.

Type:
FrameRequestCallback
Since: 3.0.0
Focus
Focus
stepTimeout: function
Focus
Focus

Description:

The SetTimeout step function.

Invokes the callback and schedules another call to setTimeout.

Type:
function
Since: 3.0.0
Focus
Focus
<nullable> timeOutID: number
Focus
Focus

Description:

The setTimeout or RAF callback ID used when canceling them.

Type:
number
Default: null
Since: 3.0.0
Focus
Focus

Methods

destroy()
Focus
Focus

Description:

Stops the step from running and clears the callback reference.

Since: 3.0.0
Focus
Focus
start(callback, forceSetTimeOut, delay)
Focus
Focus

Description:

Starts the requestAnimationFrame or setTimeout process running.

Parameters:

name type description
callback FrameRequestCallback

The callback to invoke each step.

forceSetTimeOut boolean

Should it use SetTimeout, even if RAF is available?

delay number

The setTimeout delay rate in ms.

Since: 3.0.0
Focus
Focus
stop()
Focus
Focus

Description:

Stops the requestAnimationFrame or setTimeout from running.

Since: 3.0.0
Focus
Focus