The PixiJS Matrix as a class makes it a lot faster.

Here is a representation of it:

| a | c | tx|
| b | d | ty|
| 0 | 0 | 1 |

Memberof

PIXI

Constructors

  • Parameters

    • Optional a: number

      x scale

    • Optional b: number

      y skew

    • Optional c: number

      x skew

    • Optional d: number

      y scale

    • Optional tx: number

      x translation

    • Optional ty: number

      y translation

    Returns Matrix

Properties

a: number

Default

1
array: null | Float32Array
b: number

Default

0
c: number

Default

0
d: number

Default

1
tx: number

Default

0
ty: number

Default

0

Accessors

  • get IDENTITY(): Matrix
  • A default (identity) matrix

    Returns Matrix

  • get TEMP_MATRIX(): Matrix
  • A temp matrix

    Returns Matrix

Methods

  • Appends the given Matrix to this Matrix.

    Parameters

    • matrix: Matrix

      The matrix to append.

    Returns this

    This matrix. Good for chaining method calls.

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

    Type Parameters

    Parameters

    • pos: IPointData

      The origin

    • Optional newPos: P

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

    Returns P

    The new point, transformed through this matrix

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

    Type Parameters

    Parameters

    • pos: IPointData

      The origin

    • Optional newPos: P

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

    Returns P

    The new point, inverse-transformed through this matrix

  • Creates a new Matrix object with the same values as this one.

    Returns Matrix

    A copy of this matrix. Good for chaining method calls.

  • Changes the values of the matrix to be the same as the ones in given matrix

    Parameters

    • matrix: Matrix

      The matrix to copy from.

    Returns this

    this

  • Changes the values of the given matrix to be the same as the ones in this matrix

    Parameters

    • matrix: Matrix

      The matrix to copy to.

    Returns Matrix

    The matrix given in parameter with its values updated.

  • Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.

    Parameters

    • transform: Transform

      The transform to apply the properties to.

    Returns Transform

    The transform with the newly applied properties

  • 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

    • array: number[]

      The array that the matrix will be populated from.

    Returns void

  • Resets this Matrix to an identity (default) matrix.

    Returns this

    This matrix. Good for chaining method calls.

  • Inverts this matrix

    Returns this

    This matrix. Good for chaining method calls.

  • Prepends the given Matrix to this Matrix.

    Parameters

    • matrix: Matrix

      The matrix to prepend

    Returns this

    This matrix. Good for chaining method calls.

  • Applies a rotation transformation to the matrix.

    Parameters

    • angle: number

      The angle in radians.

    Returns this

    This matrix. Good for chaining method calls.

  • Applies a scale transformation to the matrix.

    Parameters

    • x: number

      The amount to scale horizontally

    • y: number

      The amount to scale vertically

    Returns this

    This matrix. Good for chaining method calls.

  • Sets the matrix properties.

    Parameters

    • a: number

      Matrix component

    • b: number

      Matrix component

    • c: number

      Matrix component

    • d: number

      Matrix component

    • tx: number

      Matrix component

    • ty: number

      Matrix component

    Returns this

    This matrix. Good for chaining method calls.

  • Sets the matrix based on all the available properties

    Parameters

    • x: number

      Position on the x axis

    • y: number

      Position on the y axis

    • pivotX: number

      Pivot on the x axis

    • pivotY: number

      Pivot on the y axis

    • scaleX: number

      Scale on the x axis

    • scaleY: number

      Scale on the y axis

    • rotation: number

      Rotation in radians

    • skewX: number

      Skew on the x axis

    • skewY: number

      Skew on the y axis

    Returns this

    This matrix. Good for chaining method calls.

  • Creates an array from the current Matrix object.

    Parameters

    • transpose: boolean

      Whether we need to transpose the matrix or not

    • Optional out: Float32Array

      If provided the array will be assigned to out

    Returns Float32Array

    The newly created array which contains the matrix

  • Translates the matrix on the x and y.

    Parameters

    • x: number

      How much to translate x by

    • y: number

      How much to translate y by

    Returns this

    This matrix. Good for chaining method calls.

Generated using TypeDoc