Transformation
A utility class for building transformation matrices.
Constructors
Transformation (matrix?: Matrix)
Creates a transformation from the specified matrix, if any.
Parameters
matrix? Matrix
The initial transformation matrix.
Methods
addObserver
Adds an observer to be notified for changes.
Parameters
observer GeometryObserver
The observer to add.
Returns
Transformation - The current Arc instance.
clone
Creates a new instance with the same transformation matrix.
Returns
Transformation - A new Transformation instance with the same matrix.
equals
Compares this transformation with another instance.
Parameters
other Transformation
The transformation to compare with.
Returns
boolean true if the transformation matrix is the same. Otherwise, returns false
.
matrix
Gets the current transformation matrix for this transformation.
Returns
Matrix - The current transformation matrix.
multiply
Multiplies the transformation by another one. The underlying transformation matrix is updated in-place.
Parameters
transformation Transformation
The transformation to multiply by.
Returns
Transformation - The current Transformation instance.
observers
Returns the list of observers.
Returns
GeometryObserver[] - The current observers.
removeObserver
Stops notifying the specified observer for changes.
Parameters
observer GeometryObserver
The observer to remove.
Returns
Transformation - The current Arc instance.
resume
Resumes the notification to all observers for changes.
Returns
Transformation - The current Arc instance.
rotate
Sets the rotation with the specified parameters.
Parameters
angle number
The angle of rotation in decimal degrees. Measured in a clockwise direction with 0 (zero) pointing "right". Negative values or values greater than 360 are normalized.
center Point | number[]
The center of rotation.
Returns
Transformation - The current transformation instance.
scale
Sets scale with the specified parameters.
Parameters
scaleX number
The scale factor on the X axis.
scaleY number
The scale factor on the Y axis.
origin? Point | number[]
The scale origin. Defaults to [0, 0].
Returns
Transformation - The current Transformation instance.
suspend
Suspends the change notifications to all observers.
Returns
Transformation - The current Arc instance.
translate
Sets the translation with the specified parameters.
Parameters
x number
The distance to translate along the X axis.
y number
The distance to translate along the Y axis.
Returns
Transformation - The current transformation instance.