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 |

Constructor

Matrix

()

Methods

apply

(
  • pos
  • [newPos]
)
Point

Get a new position with the current transormation 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 trough this matrix

apply

(
  • pos
  • [newPos]
)
Point

Get a new position with the inverse of the current transormation 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 trough this matrix

fromArray

(
  • array
)

Creates a pixi matrix object based on the array given as a parameter

Parameters:

  • array Array

    The array that the matrix will be filled with

rotate

(
  • angle
)
Matrix

Applies a rotation transformation to the matrix.

Parameters:

  • angle Number

    The angle in radians.

Returns:

Matrix:

This matrix. Good for chaining method calls.

scale

(
  • x
  • y
)
Matrix

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
)
Matrix

Translates the matrix on the x and y.

Parameters:

  • x Number
  • y Number

Returns:

Matrix:

This matrix. Good for chaining method calls.

translate

(
  • x
  • y
)
Matrix

Translates the matrix on the x and y.

Parameters:

  • x Number
  • y Number

Returns:

Matrix:

This matrix. Good for chaining method calls.