Interface IMatrix2D

interface IMatrix2D {
    a: number;
    b: number;
    c: number;
    d: number;
    tx: number;
    ty: number;
    append(a, b, c, d, tx, ty): IMatrix2D;
    appendMatrix(matrix): IMatrix2D;
    appendTransform(x, y, scaleX, scaleY, rotation, skewX, skewY, regX?, regY?): IMatrix2D;
    clone(): IMatrix2D;
    copy(matrix): IMatrix2D;
    decompose(target?): DecomposedProps;
    equals(matrix): boolean;
    identity(): IMatrix2D;
    invert(): IMatrix2D;
    isIdentity(): boolean;
    prepend(a, b, c, d, tx, ty): IMatrix2D;
    prependMatrix(matrix): IMatrix2D;
    prependTransform(x, y, scaleX, scaleY, rotation, skewX, skewY, regX?, regY?): IMatrix2D;
    rotate(angle): IMatrix2D;
    scale(x, y): IMatrix2D;
    setValues(a?, b?, c?, d?, tx?, ty?): IMatrix2D;
    skew(skewX, skewY): IMatrix2D;
    toString(): string;
    transformPoint(x, y, pt?): IPoint;
    translate(x, y): IMatrix2D;
}

Implemented by

Properties

a: number

Position (0, 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.

d: number

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

tx: number

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

ty: number

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

Methods

  • Appends the specified matrix properties to this matrix. All parameters are required. This is the equivalent of multiplying (this matrix) * (specified matrix).

    Parameters

    • a: number
    • b: number
    • c: number
    • d: number
    • tx: number
    • ty: number

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Appends the specified matrix to this matrix. This is the equivalent of multiplying (this matrix) * (specified matrix).

    Parameters

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Generates matrix properties from the specified display object transform properties, and appends them to this matrix. For example, you can use this to generate a matrix representing the transformations of a display object:

        var mtx = new createjs.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
    • Optional regX: number

      Optional.

    • Optional regY: number

      Optional.

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Returns a clone of the Matrix2D instance.

    Returns IMatrix2D

    a clone of the Matrix2D instance.

  • Copies all properties from the specified matrix to this matrix.

    Parameters

    • matrix: IMatrix2D

      The matrix to copy properties from.

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Decomposes the matrix into transform properties (x, y, scaleX, scaleY, and rotation). Note that these values may not match the transform properties you used to generate the matrix, though they will produce the same visual results.

    Parameters

    • Optional target: DecomposedProps

      The object to apply the transform properties to. If null, then a new object will be returned.

    Returns DecomposedProps

    The target, or a new generic object with the transform properties applied.

  • Returns true if this matrix is equal to the specified matrix (all property values are equal).

    Parameters

    Returns boolean

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

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

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

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Returns true if the matrix is an identity matrix.

    Returns boolean

  • Prepends the specified matrix properties to this matrix. This is the equivalent of multiplying (specified matrix) * (this matrix). All parameters are required.

    Parameters

    • a: number
    • b: number
    • c: number
    • d: number
    • tx: number
    • ty: number

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Prepends the specified matrix to this matrix. This is the equivalent of multiplying (specified matrix) * (this matrix). For example, you could calculate the combined transformation for a child object using:

        var o = myDisplayObject;
    var mtx = o.getMatrix();
    while (o = o.parent) {
    // prepend each parent's transformation in turn:
    o.prependMatrix(o.getMatrix());
    }

    Parameters

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Generates matrix properties from the specified display object transform properties, and prepends them to this matrix. For example, you could calculate the combined transformation for a child object using:

     var o = myDisplayObject;
    var mtx = new createjs.Matrix2D();
    do {
    // prepend each parent's transformation in turn:
    mtx.prependTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation, o.skewX, o.skewY, o.regX, o.regY);
    } while (o = o.parent);

    Parameters

    • x: number
    • y: number
    • scaleX: number
    • scaleY: number
    • rotation: number
    • skewX: number
    • skewY: number
    • Optional regX: number

      Optional.

    • Optional regY: number

      Optional.

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Applies a clockwise rotation transformation to the matrix.

    Parameters

    • angle: number

      The angle to rotate by, in degrees. To use a value in radians, multiply it by 180/Math.PI.

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Applies a scale transformation to the matrix.

    Parameters

    • x: number

      The amount to scale horizontally. E.G. a value of 2 will double the size in the X direction, and 0.5 will halve it.

    • y: number

      The amount to scale vertically.

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Sets the specified values on this instance.

    Parameters

    • Optional a: number

      Specifies the a property for the new matrix.

    • Optional b: number

      Specifies the b property for the new matrix.

    • Optional c: number

      Specifies the c property for the new matrix.

    • Optional d: number

      Specifies the d property for the new matrix.

    • Optional tx: number

      Specifies the tx property for the new matrix.

    • Optional ty: number

      Specifies the ty property for the new matrix.

    Returns IMatrix2D

    This instance. Useful for chaining method calls.

  • Applies a skew transformation to the matrix.

    Parameters

    • skewX: number

      The amount to skew horizontally in degrees. To use a value in radians, multiply it by 180/Math.PI.

    • skewY: number

      The amount to skew vertically in degrees.

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.

  • Returns a string representation of this object.

    Returns string

    a string representation of the instance.

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

    • Optional pt: any

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

    Returns IPoint

    This matrix. Useful for chaining method calls.

  • Translates the matrix on the x and y axes.

    Parameters

    • x: number
    • y: number

    Returns IMatrix2D

    This matrix. Useful for chaining method calls.