Members
-
<static, constant> IDENTITY
-
A default (identity) matrix
- Source:
-
<static, constant> TEMP_MATRIX
-
A temp matrix
- Source:
-
a :number
-
Type:
- number
- Default Value:
-
- 1
- Source:
-
b :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
-
c :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
-
d :number
-
Type:
- number
- Default Value:
-
- 1
- Source:
-
tx :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
-
ty :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
Methods
-
append(matrix)
-
Appends the given Matrix to this Matrix.
Parameters:
Name Type Description matrixMatrix Matrix to append
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
apply(pos [, newPos])
-
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:
Name Type Argument Description posVector The origin
newPosVector <optional>
The point that the new position is assigned to (allowed to be same as input)
- Source:
Returns:
The new point, transformed through this matrix
- Type
- Vector
-
applyInverse(pos [, newPos])
-
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:
Name Type Argument Description posVector The origin
newPosVector <optional>
The point that the new position is assigned to (allowed to be same as input)
- Source:
Returns:
The new point, inverse-transformed through this matrix
- Type
- Vector
-
clone()
-
Creates a new Matrix object with the same values as this one.
- Source:
Returns:
A copy of this matrix. Good for chaining method calls.
- Type
- Matrix
-
copy(matrix)
-
Changes the values of the given matrix to be the same as the ones in this matrix
Parameters:
Name Type Description matrixMatrix Target matrix to set to
- Source:
Returns:
The matrix given in parameter with its values updated.
- Type
- Matrix
-
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]Parameters:
Name Type Description arrayArray.<number> The array that the matrix will be populated from.
- Source:
-
identity()
-
Resets this Matix to an identity (default) matrix.
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
invert()
-
Inverts this matrix
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
prepend(matrix)
-
Prepends the given Matrix to this Matrix.
Parameters:
Name Type Description matrixMatrix Matrix to prepend
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
rotate(angle)
-
Applies a rotation transformation to the matrix.
Parameters:
Name Type Description anglenumber The angle in radians.
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
scale(x, y)
-
Applies a scale transformation to the matrix.
Parameters:
Name Type Description xnumber The amount to scale horizontally
ynumber The amount to scale vertically
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
set(a, b, c, d, tx, ty)
-
sets the matrix properties
Parameters:
Name Type Description anumber Matrix property a
bnumber Matrix property b
cnumber Matrix property c
dnumber Matrix property d
txnumber Matrix property tx
tynumber Matrix property ty
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY)
-
Sets the matrix based on all the available properties
Parameters:
Name Type Description xnumber Position x
ynumber Position y
pivotXnumber Pivot x
pivotYnumber Pivot y
scaleXnumber Scale x
scaleYnumber Scale y
rotationnumber Rotation
skewXnumber Skew x
skewYnumber Skew y
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix
-
toArray(transpose [, out])
-
Creates an array from the current Matrix object.
Parameters:
Name Type Argument Description transposeboolean Whether we need to transpose the matrix or not
outArray <optional>
If provided the array will be assigned to out
- Source:
Returns:
the newly created array which contains the matrix
- Type
- Array.<number>
-
translate(x, y)
-
Translates the matrix on the x and y.
Parameters:
Name Type Description xnumber The amount to move on x axis
ynumber The amount to move on y axis
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix