These docs are for an outdated version of Phaser The documentation on this page is for Phaser 2.4.6. The latest release is 2.8.7.

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.

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)