EaselJS

EaselJS  0.4.2

EaselJS > EaselJS > Matrix2D
Search:
 
Filters

Class Matrix2D

Represents an affine transformation matrix, and provides tools for constructing and concatenating matrixes.

Constructor

Matrix2D ( a , b , c , d , tx , ty )
Parameters:
a <Number> Specifies the a property for the new matrix.
b <Number> Specifies the b property for the new matrix.
c <Number> Specifies the c property for the new matrix.
d <Number> Specifies the d property for the new matrix.
tx <Number> Specifies the tx property for the new matrix.
ty <Number> Specifies the ty property for the new matrix.

Properties

a - Number

Position (0, 0) in a 3x3 affine transformation matrix.

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.

atx - Number

Position (2, 0) in a 3x3 affine transformation matrix.

b - Number

Position (0, 1) in a 3x3 affine transformation matrix.

c - Number

Position (1, 0) in a 3x3 affine transformation matrix.

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

d - Number

Position (1, 1) in a 3x3 affine transformation matrix.

DEG_TO_RAD - static final Number

Multiplier for converting degrees to radians. Used internally by Matrix2D. Read-only.

identity - static Matrix2D

An identity matrix, representing a null transformation. 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.

ty - Number

Position (2, 1) in a 3x3 affine transformation matrix.

Methods

append

void append ( a , b , c , d , tx , ty )
Appends the specified matrix properties with this matrix. All parameters are required.
Parameters:
a <Number>
b <Number>
c <Number>
d <Number>
tx <Number>
ty <Number>
Returns: void

appendMatrix

void appendMatrix ( matrix )
Appends the specified matrix with this matrix.
Parameters:
matrix <Matrix2D>
Returns: void

appendProperties

void appendProperties ( a , b , c , d , tx , ty , alpha , shadow , compositeOperation )
Reinitializes all matrix properties to those specified.
Parameters:
a <Number>
b <Number>
c <Number>
d <Number>
tx <Number>
ty <Number>
alpha <Number> desired alpha value
shadow <Shadow> desired shadow value
compositeOperation <String> desired composite operation value
Returns: void

appendTransform

void 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:
x <Number>
y <Number>
scaleX <Number>
scaleY <Number>
rotation <Number>
skewX <Number>
skewY <Number>
regX <Number> Optional.
regY <Number> Optional.
Returns: void

clone

Matrix2D clone ( )
Returns a clone of the Matrix2D instance.
Returns: Matrix2D
a clone of the Matrix2D instance.

decompose

void 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 <Object> The object to apply the transform properties to. If null, then a new object will be returned.
Returns: void

identity

void identity ( )
Sets the properties of the matrix to those of an identity matrix (one that applies a null transformation).
Returns: void

initialize

protected void initialize ( )
Initialization method.
Returns: void

invert

void invert ( )
Inverts the matrix, causing it to perform the opposite transformation.
Returns: void

isIdentity

void isIdentity ( )
Returns true if the matrix is an identity matrix.
Returns: void

prepend

void prepend ( a , b , c , d , tx , ty )
Concatenates the specified matrix properties with this matrix. All parameters are required.
Parameters:
a <Number>
b <Number>
c <Number>
d <Number>
tx <Number>
ty <Number>
Returns: void

prependMatrix

void prependMatrix ( matrix )
Prepends the specified matrix with this matrix.
Parameters:
matrix <Matrix2D>
Returns: void

prependProperties

void prependProperties ( alpha , shadow , compositeOperation )
Prepends the specified visual properties to the current matrix.
Parameters:
alpha <Number> desired alpha value
shadow <Shadow> desired shadow value
compositeOperation <String> desired composite operation value
Returns: void

prependTransform

void 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:
x <Number>
y <Number>
scaleX <Number>
scaleY <Number>
rotation <Number>
skewX <Number>
skewY <Number>
regX <Number> Optional.
regY <Number> Optional.
Returns: void

rotate

void rotate ( angle )
Applies a rotation transformation to the matrix.
Parameters:
angle <Number> The angle in degrees.
Returns: void

scale

void scale ( x , y )
Applies a scale transformation to the matrix.
Parameters:
x <Number>
y <Number>
Returns: void

skew

void skew ( skewX , skewY )
Applies a skew transformation to the matrix.
Parameters:
skewX <Number> The amount to skew horizontally in degrees.
skewY <Number> The amount to skew vertically in degrees.
Returns: void

toString

String toString ( )
Returns a string representation of this object.
Returns: String
a string representation of the instance.

translate

void translate ( x , y )
Translates the matrix on the x and y axes.
Parameters:
x <Number>
y <Number>
Returns: void