Matrix Class
The Matrix class is now an object, which makes it a lot faster, here is a representation of it : | a | b | tx| | c | d | ty| | 0 | 0 | 1 |
Constructor
Matrix
()
Methods
apply
-
pos
-
[newPos]
Get a new position with the current transormation applied. Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)
Parameters:
Returns:
The new point, transformed trough this matrix
apply
-
pos
-
[newPos]
Get a new position with the inverse of the current transormation applied. Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)
Parameters:
Returns:
The new point, inverse-transformed trough this matrix
fromArray
-
array
Creates a pixi matrix object based on the array given as a parameter
Parameters:
-
array
ArrayThe array that the matrix will be filled with
rotate
-
angle
Applies a rotation transformation to the matrix.
Parameters:
-
angle
NumberThe angle in radians.
Returns:
This matrix. Good for chaining method calls.
scale
-
x
-
y
Applies a scale transformation to the matrix.
Parameters:
-
x
NumberThe amount to scale horizontally
-
y
NumberThe amount to scale vertically
Returns:
This matrix. Good for chaining method calls.
toArray
-
transpose
Creates an array from the current Matrix object
Parameters:
-
transpose
BooleanWhether we need to transpose the matrix or not
Returns:
the newly created array which contains the matrix