Matrix

Matrix

new Matrix(a, b, c, d, tx, ty)

The Matrix class.
Parameters:
Name Type Description
a number | array Horizontal/x scale or array of a, b, c, d, tx, ty
b number Vertical/y skew
c number Horizontal/x skew
d number Vertical/y scale
tx number Horizontal/x translation
ty number Vertical/y translation

Methods

clone() → {Matrix}

Returns a clone of the matrix
Returns:
Type
Matrix

concat(m) → {Matrix}

Concatenates a matrix with the current matrix. Effectively combines the geometric effects of the two matrices.
Parameters:
Name Type Description
m Matrix
Returns:
The instance
Type
Matrix

createBox(scaleX, scaleY, rotation, tx, ty) → {Matrix}

Applies parameters for scaling, rotation, and translation. Using the createBox() method lets you obtain the same matrix as you would if you applied the identity(), rotate(), scale(), and translate() methods in succession.
Parameters:
Name Type Description
scaleX number The horizontal scale
scaleY number The vertical scale
rotation number The rotation in radians
tx number The horizontal translation
ty number The vertical translation
Returns:
The instance
Type
Matrix

deltaTransformPoint(point) → {Point}

Given a point in the pretransform coordinate space, returns the coordinates of that point after the transformation occurs. Unlike the standard transformation applied using the transformPoint() method, the deltaTransformPoint() method's transformation does not consider the translation parameters tx and ty.
Parameters:
Name Type Description
point Point The point to transform
Returns:
Type
Point

identity() → {Matrix}

Sets each matrix property to a value that causes a null transformation. An object transformed by applying an identity matrix will be identical to the original.
Returns:
The instance
Type
Matrix

invert() → {Matrix}

Performs the opposite transformation of the original matrix. You can apply an inverted matrix to an object to undo the transformation performed when applying the original matrix.
Returns:
The instance
Type
Matrix

rotate(angle) → {Matrix}

Applies a rotation transformation to the Matrix object.
Parameters:
Name Type Description
angle number The rotation angle in radians.
Returns:
The instance
Type
Matrix

scale(sx, sy) → {Matrix}

Applies a scaling transformation to the matrix. The x axis is multiplied by sx, and the y axis it is multiplied by sy.
Parameters:
Name Type Description
sx number Multiplier for the x axis
sy number Multiplier for the y axis
Returns:
The instance
Type
Matrix

transformPoint(point) → {Point}

Returns the result of applying the geometric transformation represented by the Matrix object to the specified point.
Parameters:
Name Type Description
point Point The point to transform
Returns:
Type
Point

translate(x, y) → {Matrix}

Translates the matrix along the x and y axes.
Parameters:
Name Type Description
x number The translation along the x axis
y number The translation along the y axis
Returns:
The instance.
Type
Matrix