Class: Transform

Transform

The Transform class facilitates the manipulation of a 2D transformation matrix through user-friendly properties: position, scale, rotation, skew, and pivot.

new Transform (options)

Name Type Description
options TransformOptions

Options for the transform.

options.matrix

The matrix to use.

options.observer

The observer to use.

Interface Definitions

TransformOptions

Options for the Transform constructor.

Properties:
Name Type Description
matrix Matrix

The matrix to use.

observer {
   _onUpdate: (transform: Transform) => void
}

The observer to use.

Members

matrix Matrix readonly

This matrix is computed by combining this Transforms position, scale, rotation, skew, and pivot properties into a single matrix.

The pivot point of the container that it rotates around.

position ObservablePoint

The coordinate of the object relative to the local coordinates of the parent.

rotation number

The rotation of the object in radians.

The scale factor of the object.

The skew amount, on the x and y axis.

_cx number protected

The X-coordinate value of the normalized local X axis, the first column of the local transformation matrix without a scale.

_cy number protected

The X-coordinate value of the normalized local Y axis, the second column of the local transformation matrix without a scale.

_rotation number protected

The rotation amount.

_sx number protected

The Y-coordinate value of the normalized local X axis, the first column of the local transformation matrix without a scale.

_sy number protected

The Y-coordinate value of the normalized local Y axis, the second column of the local transformation matrix without a scale.

Methods

setFromMatrix (matrix) void

Decomposes a matrix and sets the transforms properties based on it.

Name Type Description
matrix Matrix

The matrix to decompose

updateSkew () void protected

Called when the skew or the rotation changes.