EaselJS

EaselJS  0.5.0

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

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

appendMatrix

Matrix2D appendMatrix ( matrix )
Appends the specified matrix with this matrix.
Parameters:
matrix <Matrix2D>
Returns: Matrix2D
This matrix. Useful for chaining method calls.

appendProperties

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

appendTransform

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

clone

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

decompose

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

identity

Matrix2D identity ( )
Sets the properties of the matrix to those of an identity matrix (one that applies a null transformation).
Returns: Matrix2D
This matrix. Useful for chaining method calls.

initialize

protected Matrix2D initialize ( )
Initialization method.
Returns: Matrix2D
This matrix. Useful for chaining method calls.

invert

Matrix2D invert ( )
Inverts the matrix, causing it to perform the opposite transformation.
Returns: Matrix2D
This matrix. Useful for chaining method calls.

isIdentity

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

prepend

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

prependMatrix

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

prependProperties

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

prependTransform

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

rotate

Matrix2D rotate ( angle )
Applies a rotation transformation to the matrix.
Parameters:
angle <Number> The angle in degrees.
Returns: Matrix2D
This matrix. Useful for chaining method calls.

scale

Matrix2D scale ( x , y )
Applies a scale transformation to the matrix.
Parameters:
x <Number>
y <Number>
Returns: Matrix2D
This matrix. Useful for chaining method calls.

skew

Matrix2D 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: Matrix2D
This matrix. Useful for chaining method calls.

toString

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

translate

Matrix2D translate ( x , y )
Translates the matrix on the x and y axes.
Parameters:
x <Number>
y <Number>
Returns: Matrix2D
This matrix. Useful for chaining method calls.