Matrix2D Class
Represents an affine transformation matrix, and provides tools for constructing and concatenating matrixes.
Constructor
Matrix2D
-
a
-
b
-
c
-
d
-
tx
-
ty
Parameters:
-
a
NumberSpecifies the a property for the new matrix.
-
b
NumberSpecifies the b property for the new matrix.
-
c
NumberSpecifies the c property for the new matrix.
-
d
NumberSpecifies the d property for the new matrix.
-
tx
NumberSpecifies the tx property for the new matrix.
-
ty
NumberSpecifies the ty property for the new matrix.
Item Index
Methods
Methods
append
-
a
-
b
-
c
-
d
-
tx
-
ty
Appends the specified matrix properties with this matrix. All parameters are required.
Returns:
appendMatrix
-
matrix
Appends the specified matrix with this matrix.
Parameters:
-
matrix
Matrix2D
Returns:
appendProperties
-
alpha
-
shadow
-
compositeOperation
Appends the specified visual properties to the current matrix.
Parameters:
Returns:
appendProperties
-
a
-
b
-
c
-
d
-
tx
-
ty
-
alpha
-
shadow
-
compositeOperation
Reinitializes all matrix properties to those specified.
Parameters:
Returns:
appendTransform
-
x
-
y
-
scaleX
-
scaleY
-
rotation
-
skewX
-
skewY
-
regX
-
regY
Generates matrix properties from the specified display object transform properties, and appends them with this matrix. For example, you can use this to generate a matrix from a display object: var mtx = new Matrix2D(); mtx.appendTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation);
Parameters:
Returns:
clone
()
Matrix2D
Returns a clone of the Matrix2D instance.
Returns:
decompose
-
target
Decomposes the matrix into transform properties (x, y, scaleX, scaleY, and rotation). Note that this these values may not match the transform properties you used to generate the matrix, though they will produce the same visual results.
Parameters:
-
target
ObjectThe object to apply the transform properties to. If null, then a new object will be returned.
Returns:
identity
()
Matrix2D
Sets the properties of the matrix to those of an identity matrix (one that applies a null transformation).
Returns:
initialize
()
Matrix2D
protected
Initialization method.
Returns:
invert
()
Matrix2D
Inverts the matrix, causing it to perform the opposite transformation.
Returns:
prepend
-
a
-
b
-
c
-
d
-
tx
-
ty
Concatenates the specified matrix properties with this matrix. All parameters are required.
Returns:
prependMatrix
-
matrix
Prepends the specified matrix with this matrix.
Parameters:
-
matrix
Matrix2D
prependProperties
-
alpha
-
shadow
-
compositeOperation
Prepends the specified visual properties to the current matrix.
Parameters:
Returns:
prependTransform
-
x
-
y
-
scaleX
-
scaleY
-
rotation
-
skewX
-
skewY
-
regX
-
regY
Generates matrix properties from the specified display object transform properties, and prepends them with this matrix. For example, you can use this to generate a matrix from a display object: var mtx = new Matrix2D(); mtx.prependTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation);
Parameters:
Returns:
rotate
-
angle
Applies a rotation transformation to the matrix.
Parameters:
-
angle
NumberThe angle in radians. To use degrees, multiply by
Math.PI/180
.
Returns:
scale
-
x
-
y
Applies a scale transformation to the matrix.
Returns:
skew
-
skewX
-
skewY
Applies a skew transformation to the matrix.
Parameters:
Returns:
Properties
alpha
Number
Property representing the alpha that will be applied to a display object. This is not part of matrix operations, but is used for operations like getConcatenatedMatrix to provide concatenated alpha values.
compositeOperation
String
Property representing the compositeOperation that will be applied to a display object. This is not part of matrix operations, but is used for operations like getConcatenatedMatrix to provide concatenated compositeOperation values. You can find a list of valid composite operations at: https://developer.mozilla.org/en/Canvas_tutorial/Compositing
DEG_TO_RAD
Number
final
static
Multiplier for converting degrees to radians. Used internally by Matrix2D. Read-only.
shadow
Shadow
Property representing the shadow that will be applied to a display object. This is not part of matrix operations, but is used for operations like getConcatenatedMatrix to provide concatenated shadow values.