Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • Matrix

Index

Constructors

constructor

  • new Matrix(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): Matrix
  • Parameters

    • Optional a: number
    • Optional b: number
    • Optional c: number
    • Optional d: number
    • Optional tx: number
    • Optional ty: number

    Returns Matrix

Properties

a

a: number

array

array: null | Float32Array

b

b: number

c

c: number

d

d: number

tx

tx: number

ty

ty: number

Accessors

Static IDENTITY

  • A default (identity) matrix

    static
    const
    member

    {PIXI.Matrix}

    Returns Matrix

Static TEMP_MATRIX

  • A temp matrix

    static
    const
    member

    {PIXI.Matrix}

    Returns Matrix

Methods

append

  • Appends the given Matrix to this Matrix.

    Parameters

    • matrix: Matrix

      The matrix to append.

    Returns Matrix

    This matrix. Good for chaining method calls.

apply

  • 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

    Returns P

    The new point, transformed through this matrix

applyInverse

  • 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

    Returns P

    The new point, inverse-transformed through this matrix

clone

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

    Returns Matrix

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

copyFrom

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

    this

copyTo

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

decompose

  • 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

fromArray

  • fromArray(array: number[]): void
  • 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

identity

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

    Returns Matrix

    This matrix. Good for chaining method calls.

invert

  • Inverts this matrix

    Returns Matrix

    This matrix. Good for chaining method calls.

prepend

  • Prepends the given Matrix to this Matrix.

    Parameters

    • matrix: Matrix

      The matrix to prepend

    Returns Matrix

    This matrix. Good for chaining method calls.

rotate

  • rotate(angle: number): 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

  • scale(x: number, y: number): 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.

set

  • set(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix
  • 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 Matrix

    This matrix. Good for chaining method calls.

setTransform

  • setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number): Matrix
  • 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 Matrix

    This matrix. Good for chaining method calls.

toArray

  • toArray(transpose: boolean, out?: Float32Array): Float32Array
  • Creates an array from the current Matrix object.

    Parameters

    • transpose: boolean

      Whether we need to transpose the matrix or not

    • Optional out: Float32Array

    Returns Float32Array

    the newly created array which contains the matrix

toString

  • toString(): string
  • Returns string

translate

  • translate(x: number, y: number): 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 Matrix

    This matrix. Good for chaining method calls.

Generated using TypeDoc