Navigation
These archived docs are for Phaser 2.6.2 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

Phaser. RequestAnimationFrame

new RequestAnimationFrame(game, forceSetTimeOut)

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

Parameters
Name Type Argument Default Description
game Phaser.Game

A reference to the currently running game.

forceSetTimeOut boolean <optional>
false

Tell Phaser to use setTimeOut even if raf is available.

Source code: utils/RequestAnimationFrame.js (Line 15)

Public Properties

forceSetTimeOut : boolean

Tell Phaser to use setTimeOut even if raf is available.

Source code: utils/RequestAnimationFrame.js (Line 33)

game : Phaser.Game

The currently running game.

Source code: utils/RequestAnimationFrame.js (Line 22)

isRunning : boolean

true if RequestAnimationFrame is running, otherwise false.

Source code: utils/RequestAnimationFrame.js (Line 28)

Public Methods

isRAF() → {boolean}

Is the browser using requestAnimationFrame?

Returns
boolean -
Source code: utils/RequestAnimationFrame.js (Line 162)

isSetTimeOut() → {boolean}

Is the browser using setTimeout?

Returns
boolean -
Source code: utils/RequestAnimationFrame.js (Line 153)

start()

Starts the requestAnimationFrame running or setTimeout if unavailable in browser

Source code: utils/RequestAnimationFrame.js (Line 70)

stop()

Stops the requestAnimationFrame from running.

Source code: utils/RequestAnimationFrame.js (Line 134)

updateRAF()

The update method for the requestAnimationFrame

Source code: utils/RequestAnimationFrame.js (Line 103)

updateSetTimeout()

The update method for the setTimeout.

Source code: utils/RequestAnimationFrame.js (Line 119)