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 matrix
Matrix 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 pos
Vector The origin
newPos
Vector <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 pos
Vector The origin
newPos
Vector <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 matrix
Matrix 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 array
Array.<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 matrix
Matrix 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 angle
number 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 x
number The amount to scale horizontally
y
number 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 a
number Matrix property a
b
number Matrix property b
c
number Matrix property c
d
number Matrix property d
tx
number Matrix property tx
ty
number 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 x
number Position x
y
number Position y
pivotX
number Pivot x
pivotY
number Pivot y
scaleX
number Scale x
scaleY
number Scale y
rotation
number Rotation
skewX
number Skew x
skewY
number 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 transpose
boolean Whether we need to transpose the matrix or not
out
Array <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 x
number The amount to move on x axis
y
number The amount to move on y axis
- Source:
Returns:
This matrix. Good for chaining method calls.
- Type
- Matrix