API Documentation for: 0.7.0
Show:

Matrix2D Class

Defined in: Matrix2D:39
Module: EaselJS

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

Constructor

Matrix2D

(
  • [a=1]
  • [b=0]
  • [c=0]
  • [d=1]
  • [tx=0]
  • [ty=0]
)

Defined in Matrix2D:39

Parameters:

  • [a=1] Number optional

    Specifies the a property for the new matrix.

  • [b=0] Number optional

    Specifies the b property for the new matrix.

  • [c=0] Number optional

    Specifies the c property for the new matrix.

  • [d=1] Number optional

    Specifies the d property for the new matrix.

  • [tx=0] Number optional

    Specifies the tx property for the new matrix.

  • [ty=0] Number optional

    Specifies the ty property for the new matrix.

Methods

append

(
  • a
  • b
  • c
  • d
  • tx
  • ty
)
Matrix2D

Defined in append:195

Appends the specified matrix properties with this matrix. All parameters are required.

Parameters:

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

appendMatrix

(
  • matrix
)
Matrix2D

Defined in appendMatrix:232

Appends the specified matrix with this matrix.

Parameters:

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

appendProperties

(
  • alpha
  • shadow
  • compositeOperation
)
Matrix2D

Appends 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.

appendTransform

(
  • x
  • y
  • scaleX
  • scaleY
  • rotation
  • skewX
  • skewY
  • regX
  • regY
)
Matrix2D

Defined in appendTransform:286

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:

Matrix2D:

This matrix. Useful for chaining method calls.

clone

() Matrix2D

Defined in clone:549

Returns a clone of the Matrix2D instance.

Returns:

Matrix2D:

a clone of the Matrix2D instance.

copy

(
  • matrix
)
Matrix2D

Defined in copy:509

Copies all properties from the specified matrix to this matrix.

Parameters:

  • matrix Matrix2D

    The matrix to copy properties from.

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

decompose

(
  • target
)
Matrix2D

Defined in decompose:454

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

Defined in identity:397

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

(
  • [a=1]
  • [b=0]
  • [c=0]
  • [d=1]
  • [tx=0]
  • [ty=0]
)
Matrix2D

Defined in initialize:147

Initialization method. Can also be used to reinitialize the instance.

Parameters:

  • [a=1] Number optional

    Specifies the a property for the new matrix.

  • [b=0] Number optional

    Specifies the b property for the new matrix.

  • [c=0] Number optional

    Specifies the c property for the new matrix.

  • [d=1] Number optional

    Specifies the d property for the new matrix.

  • [tx=0] Number optional

    Specifies the tx property for the new matrix.

  • [ty=0] Number optional

    Specifies the ty property for the new matrix.

Returns:

Matrix2D:

This instance. Useful for chaining method calls.

invert

() Matrix2D

Defined in invert:409

Inverts the matrix, causing it to perform the opposite transformation.

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

isIdentity

() Boolean

Defined in isIdentity:431

Returns true if the matrix is an identity matrix.

Returns:

prepend

(
  • a
  • b
  • c
  • d
  • tx
  • ty
)
Matrix2D

Defined in prepend:169

Concatenates the specified matrix properties with this matrix. All parameters are required.

Parameters:

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

prependMatrix

(
  • matrix
)

Defined in prependMatrix:221

Prepends the specified matrix with this matrix.

Parameters:

prependProperties

(
  • alpha
  • shadow
  • compositeOperation
)
Matrix2D

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

(
  • x
  • y
  • scaleX
  • scaleY
  • rotation
  • skewX
  • skewY
  • regX
  • regY
)
Matrix2D

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:

Matrix2D:

This matrix. Useful for chaining method calls.

reinitialize

(
  • [a=1]
  • [b=0]
  • [c=0]
  • [d=1]
  • [tx=0]
  • [ty=0]
  • [alpha=1]
  • [shadow=null]
  • [compositeOperation=null]
)
Matrix2D

Defined in reinitialize:487

Reinitializes all matrix properties to those specified.

Parameters:

  • [a=1] Number optional

    Specifies the a property for the new matrix.

  • [b=0] Number optional

    Specifies the b property for the new matrix.

  • [c=0] Number optional

    Specifies the c property for the new matrix.

  • [d=1] Number optional

    Specifies the d property for the new matrix.

  • [tx=0] Number optional

    Specifies the tx property for the new matrix.

  • [ty=0] Number optional

    Specifies the ty property for the new matrix.

  • [alpha=1] Number optional

    desired alpha value

  • [shadow=null] Shadow optional

    desired shadow value

  • [compositeOperation=null] String optional

    desired composite operation value

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

rotate

(
  • angle
)
Matrix2D

Defined in rotate:330

Applies a rotation transformation to the matrix.

Parameters:

  • angle Number

    The angle in radians. To use degrees, multiply by Math.PI/180.

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

scale

(
  • x
  • y
)
Matrix2D

Defined in scale:367

Applies a scale transformation to the matrix.

Parameters:

  • x Number

    The amount to scale horizontally

  • y Number

    The amount to scale vertically

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

skew

(
  • skewX
  • skewY
)
Matrix2D

Defined in skew:353

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

Defined in toString:558

Returns a string representation of this object.

Returns:

String:

a string representation of the instance.

transformPoint

(
  • x
  • y
  • [pt]
)

Defined in transformPoint:440

Transforms a point according to this matrix.

Parameters:

  • x Number

    The x component of the point to transform.

  • y Number

    The y component of the point to transform.

  • [pt] Point | Object optional

    An object to copy the result into. If omitted a generic object with x/y properties will be returned.

translate

(
  • x
  • y
)
Matrix2D

Defined in translate:384

Translates the matrix on the x and y axes.

Parameters:

Returns:

Matrix2D:

This matrix. Useful for chaining method calls.

Properties

a

Number

Defined in a:78

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

alpha

Number

Defined in alpha:120

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.

b

Number

Defined in b:85

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

c

Number

Defined in c:92

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

Defined in d:99

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

DEG_TO_RAD

Number final static

Defined in DEG_TO_RAD:66

Multiplier for converting degrees to radians. Used internally by Matrix2D.

identity

Matrix2D static

Defined in identity:57

An identity matrix, representing a null transformation.

shadow

Shadow

Defined in shadow:128

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.

tx

Number

Defined in tx:106

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

ty

Number

Defined in ty:113

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