 API Docs for: 2.0.0
Show:

Matrix Class

Module: PIXI

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 |

()

Methods

append

(
• matrix
)

Appends the given Matrix to this Matrix.

Returns:

Matrix:

This matrix. Good for chaining method calls.

apply

(
• pos
• [newPos]
)

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:

• 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

applyInverse

(
• pos
• [newPos]
)

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:

• 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

fromArray

(
• array
)

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

a = array b = array c = array d = array tx = array ty = array

Parameters:

• array Array

The array that the matrix will be populated from.

identity

()

Resets this Matix to an identity (default) matrix.

Returns:

Matrix:

This matrix. Good for chaining method calls.

rotate

(
• angle
)

Applies a rotation transformation to the matrix.

• angle Number

Returns:

Matrix:

This matrix. Good for chaining method calls.

scale

(
• x
• y
)

Applies a scale transformation to the matrix.

Parameters:

• x Number

The amount to scale horizontally

• y Number

The amount to scale vertically

Returns:

Matrix:

This matrix. Good for chaining method calls.

toArray

(
• transpose
)
Array

Creates an array from the current Matrix object.

Parameters:

• transpose Boolean

Whether we need to transpose the matrix or not

Returns:

Array:

the newly created array which contains the matrix

translate

(
• x
• y
)

Translates the matrix on the x and y.

• x Number
• y Number

Returns:

Matrix:

This matrix. Good for chaining method calls.

Number

Default: 1

Number

Default: 0

Number

Default: 0

Number

Default: 1

Number

Default: 0

Number

Default: 0