These archived docs are for Phaser 2.2.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: system/RequestAnimationFrame.js, line 15

Public Properties

forceSetTimeOut : boolean

Tell Phaser to use setTimeOut even if raf is available.

Source code: system/RequestAnimationFrame.js, line 33

game : Phaser.Game

The currently running game.

Source code: system/RequestAnimationFrame.js, line 22

isRunning : boolean

true if RequestAnimationFrame is running, otherwise false.

Default Value
  • false
Source code: system/RequestAnimationFrame.js, line 28

Public Methods

isRAF() → {boolean}

Is the browser using requestAnimationFrame?

Returns
boolean -
Source code: system/RequestAnimationFrame.js, line 157

isSetTimeOut() → {boolean}

Is the browser using setTimeout?

Returns
boolean -
Source code: system/RequestAnimationFrame.js, line 148

start()

Starts the requestAnimationFrame running or setTimeout if unavailable in browser

Source code: system/RequestAnimationFrame.js, line 70

stop()

Stops the requestAnimationFrame from running.

Source code: system/RequestAnimationFrame.js, line 129

updateRAF()

The update method for the requestAnimationFrame

Source code: system/RequestAnimationFrame.js, line 103

updateSetTimeout()

The update method for the setTimeout.

Source code: system/RequestAnimationFrame.js, line 117