Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TransformMatrix

Represents the matrix for a transform.

Hierarchy

  • Matrix
    • TransformMatrix

Implements

  • TransformId

Index

Constructors

constructor

  • Creates a new transform matrix using the specified matrix array.

    Parameters

    • Optional array: ArrayLike<number>

      The matrix array, expected length is 16. If empty, an identity matrix is used by default.

    Returns TransformMatrix

Properties

Private Optional _backward

_backward: MatrixComponent

Private Optional _down

_down: MatrixComponent

Private Optional _forward

_forward: MatrixComponent

Private Optional _left

_left: MatrixComponent

Private Optional _position

_position: MatrixComponent

Private Optional _right

_right: MatrixComponent

Private Optional _rotation

_rotation: MatrixComponent

Private Optional _scaling

_scaling: MatrixComponent

Private _transformId

_transformId: number = 0

Private Optional _up

_up: MatrixComponent

a

a: number

array

array: Float32Array

The array containing the matrix data.

b

b: number

c

c: number

d

d: number

tx

tx: number

ty

ty: number

Accessors

backward

  • get backward(): Float32Array

down

  • get down(): Float32Array

forward

  • get forward(): Float32Array

left

  • get left(): Float32Array

position

  • get position(): Float32Array

right

  • get right(): Float32Array

rotation

  • get rotation(): Float32Array

scaling

  • get scaling(): Float32Array

transformId

  • get transformId(): number

up

  • get up(): Float32Array

Static IDENTITY

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

    static
    const
    member

    {PIXI.Matrix}

    Returns Matrix

Static TEMP_MATRIX

  • get TEMP_MATRIX(): Matrix
  • A temp matrix

    static
    const
    member

    {PIXI.Matrix}

    Returns Matrix

Methods

append

  • append(matrix: Matrix): this
  • Appends the given Matrix to this Matrix.

    Parameters

    • matrix: Matrix

      The matrix to append.

    Returns this

    This matrix. Good for chaining method calls.

apply

  • apply<P>(pos: IPointData, newPos?: P): P
  • 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

    • P: IPointData

    Parameters

    • pos: IPointData

      The origin

    • Optional newPos: P

    Returns P

    The new point, transformed through this matrix

applyInverse

  • applyInverse<P>(pos: IPointData, newPos?: P): P
  • 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

    • P: IPointData

    Parameters

    • pos: IPointData

      The origin

    • Optional newPos: P

    Returns P

    The new point, inverse-transformed through this matrix

clone

  • clone(): 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.

copyFrom

copyTo

  • copyTo(matrix: Matrix): Matrix
  • 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

  • decompose(transform: Transform): Transform
  • 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

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

    Returns this

    This matrix. Good for chaining method calls.

invert

  • invert(): this
  • Inverts this matrix

    Returns this

    This matrix. Good for chaining method calls.

prepend

  • prepend(matrix: Matrix): this
  • Prepends the given Matrix to this Matrix.

    Parameters

    • matrix: Matrix

      The matrix to prepend

    Returns this

    This matrix. Good for chaining method calls.

rotate

  • rotate(angle: number): this
  • Applies a rotation transformation to the matrix.

    Parameters

    • angle: number

      The angle in radians.

    Returns this

    This matrix. Good for chaining method calls.

scale

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

set

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

setFromMultiply

setFromRotationPositionScale

setTransform

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

toArray

  • toArray(transpose: boolean, out?: Float32Array): Float32Array

toString

  • toString(): string

translate

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