Navigation
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

PIXI. Matrix

new Matrix()

The Matrix class is now an object, which makes it a lot faster, here is a representation of it : | a | b | tx | | c | d | ty | | 0 | 0 | 1 |

Source code: pixi/geom/Matrix.js, line 5

Public Properties

a : number

Default Value
  • 1
Source code: pixi/geom/Matrix.js, line 17

b : number

Default Value
  • 0
Source code: pixi/geom/Matrix.js, line 24

c : number

Default Value
  • 0
Source code: pixi/geom/Matrix.js, line 31

d : number

Default Value
  • 1
Source code: pixi/geom/Matrix.js, line 38

tx : number

Default Value
  • 0
Source code: pixi/geom/Matrix.js, line 45

ty : number

Default Value
  • 0
Source code: pixi/geom/Matrix.js, line 52

Public Methods

append(matrix) → {PIXI.Matrix}

Appends the given Matrix to this Matrix.

Parameters
Name Type Description
matrix PIXI.Matrix

-

Returns

This matrix. Good for chaining method calls.

Source code: pixi/geom/Matrix.js, line 225

apply(pos, newPos) → {PIXI.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 PIXI.Point

The origin

newPos PIXI.Point <optional>

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

Returns

The new point, transformed through this matrix

Source code: pixi/geom/Matrix.js, line 123

applyInverse(pos, newPos) → {PIXI.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 PIXI.Point

The origin

newPos PIXI.Point <optional>

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

Returns

The new point, inverse-transformed through this matrix

Source code: pixi/geom/Matrix.js, line 142

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: pixi/geom/Matrix.js, line 60

identity() → {PIXI.Matrix}

Resets this Matix to an identity (default) matrix.

Returns

This matrix. Good for chaining method calls.

Source code: pixi/geom/Matrix.js, line 250

rotate(angle) → {PIXI.Matrix}

Applies a rotation transformation to the matrix.

Parameters
Name Type Description
angle Number

The angle in radians.

Returns

This matrix. Good for chaining method calls.

Source code: pixi/geom/Matrix.js, line 200

scale(x, y) → {PIXI.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

This matrix. Good for chaining method calls.

Source code: pixi/geom/Matrix.js, line 179

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: pixi/geom/Matrix.js, line 83

translate(x, y) → {PIXI.Matrix}

Translates the matrix on the x and y.

Parameters
Name Type Description
x Number

-

y Number

-

Returns

This matrix. Good for chaining method calls.

Source code: pixi/geom/Matrix.js, line 163