new PIXI.Matrix()
The pixi Matrix class as an object, which makes it a lot faster,
here is a representation of it :
| a | b | tx|
| c | d | ty|
| 0 | 0 | 1 |
Members
-
static,constantPIXI.Matrix.IDENTITY
-
A default (identity) matrix
-
static,constantPIXI.Matrix.TEMP_MATRIX
-
A temp matrix
-
anumber
-
- Default Value:
- 1
-
bnumber
-
- Default Value:
- 0
-
cnumber
-
- Default Value:
- 0
-
dnumber
-
- Default Value:
- 1
-
txnumber
-
- Default Value:
- 0
-
tynumber
-
- Default Value:
- 0
Methods
-
append(matrix){PIXI.Matrix}
-
Appends the given Matrix to this Matrix.
Name Type Description matrix
PIXI.Matrix Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
apply(pos, newPos){PIXI.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)Name Type Description pos
PIXI.Point The origin
newPos
PIXI.Point optional The point that the new position is assigned to (allowed to be same as input)
Returns:
Type Description PIXI.Point The new point, transformed through this matrix -
applyInverse(pos, newPos){PIXI.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)Name Type Description pos
PIXI.Point The origin
newPos
PIXI.Point optional The point that the new position is assigned to (allowed to be same as input)
Returns:
Type Description PIXI.Point The new point, inverse-transformed through this matrix -
clone(){PIXI.Matrix}
-
Creates a new Matrix object with the same values as this one.
Returns:
Type Description PIXI.Matrix A copy of this matrix. Good for chaining method calls. -
copy(){PIXI.Matrix}
-
Changes the values of the given matrix to be the same as the ones in this matrix
Returns:
Type Description PIXI.Matrix The matrix given in parameter with its values updated. -
fromArray(array)
-
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]Name Type Description array
Array.<number> The array that the matrix will be populated from.
-
identity(){PIXI.Matrix}
-
Resets this Matix to an identity (default) matrix.
Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
invert(){PIXI.Matrix}
-
Inverts this matrix
Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
prepend(matrix){PIXI.Matrix}
-
Prepends the given Matrix to this Matrix.
Name Type Description matrix
PIXI.Matrix Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
rotate(angle){PIXI.Matrix}
-
Applies a rotation transformation to the matrix.
Name Type Description angle
number The angle in radians.
Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
scale(x, y){PIXI.Matrix}
-
Applies a scale transformation to the matrix.
Name Type Description x
number The amount to scale horizontally
y
number The amount to scale vertically
Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
set(a, b, c, d, tx, ty){PIXI.Matrix}
-
sets the matrix properties
Name Type Description a
number b
number c
number d
number tx
number ty
number Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY){PIXI.Matrix}
-
Sets the matrix based on all the available properties
Name Type Description x
number y
number pivotX
number pivotY
number scaleX
number scaleY
number rotation
number skewX
number skewY
number Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls. -
toArray(transpose, out){Array.<number>}
-
Creates an array from the current Matrix object.
Name Type Description transpose
boolean Whether we need to transpose the matrix or not
out
Array optional If provided the array will be assigned to out
Returns:
Type Description Array.<number> the newly created array which contains the matrix -
translate(x, y){PIXI.Matrix}
-
Translates the matrix on the x and y.
Name Type Description x
number y
number Returns:
Type Description PIXI.Matrix This matrix. Good for chaining method calls.