Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Scene2D
Phaser.Types.Cameras.Scene2D

Type Definitions

CameraConfig
Focus
Focus
Properties:
name type arguments Default description
name string <optional> ''

The name of the Camera.

x number <optional> 0

The horizontal position of the Camera viewport.

y number <optional> 0

The vertical position of the Camera viewport.

width number <optional>

The width of the Camera viewport.

height number <optional>

The height of the Camera viewport.

zoom number <optional> 1

The default zoom level of the Camera.

rotation number <optional> 0

The rotation of the Camera, in radians.

roundPixels boolean <optional> false

Should the Camera round pixels before rendering?

scrollX number <optional> 0

The horizontal scroll position of the Camera.

scrollY number <optional> 0

The vertical scroll position of the Camera.

backgroundColor false | string <optional> false

A CSS color string controlling the Camera background color.

bounds object <optional>

Defines the Camera bounds.

bounds.x number <optional> 0

The top-left extent of the Camera bounds.

bounds.y number <optional> 0

The top-left extent of the Camera bounds.

bounds.width number <optional>

The width of the Camera bounds.

bounds.height number <optional>

The height of the Camera bounds.

Type:
object
Since: 3.0.0
Focus
Focus
CameraFadeCallback(camera, progress)
Focus
Focus

Parameters:

name type description
camera Phaser.Cameras.Scene2D.Camera

The camera on which the effect is running.

progress number

The progress of the effect. A value between 0 and 1.

Type:
function
Since: 3.5.0
Focus
Focus
CameraFlashCallback(camera, progress)
Focus
Focus

Parameters:

name type description
camera Phaser.Cameras.Scene2D.Camera

The camera on which the effect is running.

progress number

The progress of the effect. A value between 0 and 1.

Type:
function
Focus
Focus
CameraPanCallback(camera, progress, x, y)
Focus
Focus

Parameters:

name type description
camera Phaser.Cameras.Scene2D.Camera

The camera on which the effect is running.

progress number

The progress of the effect. A value between 0 and 1.

x number

The Camera's new scrollX coordinate.

y number

The Camera's new scrollY coordinate.

Type:
function
Since: 3.5.0
Focus
Focus
CameraShakeCallback(camera, progress)
Focus
Focus

Parameters:

name type description
camera Phaser.Cameras.Scene2D.Camera

The camera on which the effect is running.

progress number

The progress of the effect. A value between 0 and 1.

Type:
function
Focus
Focus
CameraZoomCallback(camera, progress, zoom)
Focus
Focus

Parameters:

name type description
camera Phaser.Cameras.Scene2D.Camera

The camera on which the effect is running.

progress number

The progress of the effect. A value between 0 and 1.

zoom number

The Camera's new zoom value.

Type:
function
Since: 3.11.0
Focus
Focus
JSONCamera
Focus
Focus
Properties:
name type arguments description
name string

The name of the camera

x number

The horizontal position of camera

y number

The vertical position of camera

width number

The width size of camera

height number

The height size of camera

zoom number

The zoom of camera

rotation number

The rotation of camera

roundPixels boolean

The round pixels st status of camera

scrollX number

The horizontal scroll of camera

scrollY number

The vertical scroll of camera

backgroundColor string

The background color of camera

bounds undefined | Phaser.Types.Cameras.Scene2D.JSONCameraBounds <optional>

The bounds of camera

Type:
object
Since: 3.0.0
Focus
Focus
JSONCameraBounds
Focus
Focus
Properties:
name type description
x number

The horizontal position of camera

y number

The vertical position of camera

width number

The width size of camera

height number

The height size of camera

Type:
object
Since: 3.0.0
Focus
Focus