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

Constructor

Public Properties

blendModes

Various blend modes supported by pixi. IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.

Properties:
Name Type Description
blendModes Object
Properties
Name Type Description
NORMAL Number
ADD Number
MULTIPLY Number
SCREEN Number
OVERLAY Number
DARKEN Number
LIGHTEN Number
COLOR_DODGE Number
COLOR_BURN Number
HARD_LIGHT Number
SOFT_LIGHT Number
DIFFERENCE Number
EXCLUSION Number
HUE Number
SATURATION Number
COLOR Number
LUMINOSITY Number
Source code: Phaser.js (Line 78)

scaleModes

The scale modes that are supported by pixi.

The DEFAULT scale mode affects the default scaling mode of future operations. It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.

Properties:
Name Type Description
scaleModes Object
Properties
Name Type Description
DEFAULT=LINEAR Number
LINEAR Number

Smooth scaling

NEAREST Number

Pixelating scaling

Source code: Phaser.js (Line 110)

Public Methods

append(matrix) → {Matrix}

Appends the given Matrix to this Matrix.

Parameters
Name Type Description
matrix Matrix
Returns
Matrix -

This matrix. Good for chaining method calls.

Source code: geom/Matrix.js (Line 241)

apply(pos, newPos) → {Point}

Get a new position with the current transformation applied. Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)

Parameters
Name Type Argument Description
pos Point

The origin

newPos Point <optional>

The point that the new position is assigned to (allowed to be same as input)

Returns
Point -

The new point, transformed through this matrix

Source code: geom/Matrix.js (Line 134)

applyInverse(pos, newPos) → {Point}

Get a new position with the inverse of the current transformation applied. Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)

Parameters
Name Type Argument Description
pos Point

The origin

newPos Point <optional>

The point that the new position is assigned to (allowed to be same as input)

Returns
Point -

The new point, inverse-transformed through this matrix

Source code: geom/Matrix.js (Line 156)

clone() → {RoundedRectangle}

Creates a clone of this Rounded Rectangle

Returns

a copy of the rounded rectangle

Source code: geom/RoundedRectangle.js (Line 60)

contains(x, y) → {Boolean}

Checks whether the x and y coordinates given are contained within this Rounded Rectangle

Parameters
Name Type Description
x Number

The X coordinate of the point to test

y Number

The Y coordinate of the point to test

Returns
Boolean -

Whether the x/y coordinates are within this Rounded Rectangle

Source code: geom/RoundedRectangle.js (Line 71)

fromArray(array)

Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:

a = array[0] b = array[1] c = array[3] d = array[4] tx = array[2] ty = array[5]

Parameters
Name Type Description
array Array

The array that the matrix will be populated from.

Source code: geom/Matrix.js (Line 67)

identity() → {Matrix}

Resets this Matix to an identity (default) matrix.

Returns
Matrix -

This matrix. Good for chaining method calls.

Source code: geom/Matrix.js (Line 266)

rotate(angle) → {Matrix}

Applies a rotation transformation to the matrix.

Parameters
Name Type Description
angle Number

The angle in radians.

Returns
Matrix -

This matrix. Good for chaining method calls.

Source code: geom/Matrix.js (Line 216)

scale(x, y) → {Matrix}

Applies a scale transformation to the matrix.

Parameters
Name Type Description
x Number

The amount to scale horizontally

y Number

The amount to scale vertically

Returns
Matrix -

This matrix. Good for chaining method calls.

Source code: geom/Matrix.js (Line 195)

<internal> sort(group)

This method will sort a Groups _hash array based on the sortDirection property.

Each function should return -1 if a > b, 1 if a < b or 0 if a === b.

Parameters
Name Type Description
group Phaser.Group

The Group to sort.

Internal:
  • This member is internal (protected) and may be modified or removed in the future.
Source code: physics/arcade/World.js (Line 427)

toArray(transpose) → {Array}

Creates an array from the current Matrix object.

Parameters
Name Type Description
transpose Boolean

Whether we need to transpose the matrix or not

Returns
Array -

the newly created array which contains the matrix

Source code: geom/Matrix.js (Line 90)

translate(x, y) → {Matrix}

Translates the matrix on the x and y.

Parameters
Name Type Description
x Number
y Number
Returns
Matrix -

This matrix. Good for chaining method calls.

Source code: geom/Matrix.js (Line 179)

Type Definitions

DisplayObject

A display object is any object that can be rendered in the Phaser/pixi.js scene graph.

This includes Phaser.Group (groups are display objects!), Phaser.Sprite, Phaser.Button, Phaser.Text as well as PIXI.DisplayObject and all derived types.

Source code: core/Group.js (Line 2055)