API Docs for: 2.2.1
Show:

Matrix Class

Defined in: pixi/geom/Matrix.hx:6

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

append

(
  • matrix
)
Matrix

Appends the given Matrix to this Matrix.

Parameters:

Returns:

Matrix:

This matrix. Good for chaining method calls.

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:

  • 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]
)
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:

  • 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 pixi matrix object based on the array given as a parameter

Parameters:

  • array Array

    The array that the matrix will be filled with

identity

() Matrix

Resets this Matix to an identity (default) matrix.

Returns:

Matrix:

This matrix. Good for chaining method calls.

rotate

(
  • angle
)
Matrix

Applies a rotation transformation to the matrix.

Parameters:

  • angle Float

    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 Float

    The amount to scale horizontally

  • y Float

    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 Bool

    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 Float
  • y Float

Returns:

Matrix:

This matrix. Good for chaining method calls.

Properties

a

Int

Default: 1

b

Int

Default: 0

c

Int

Default: 0

d

Number

Default: 1

tx

Number

Default: 0

ty

Number

Default: 0