Multiplies the point with the matrix to apply the transformation. Transforming a "point" means also applying any translation from the matrix.
| x'| | a c e | | x | | y'| = | b d f | * | y | | 1 | | 0 0 1 | | 1 |
Multiplies the vector with the matrix to apply the transformation. Transforming a "vector" does ignore the translation of the matrix.
| x'| | a c e | | x | | y'| = | b d f | * | y | | 0 | | 0 0 1 | | 0 |
Returns a new instance of this Record type with all values set to their default values.
Returns a new instance of this Record type with the value for the specific key set to its default value.
Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.
If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.
OptionalnotSetValue: anyCalculates the inverse matrix. This requires the determinant to be != 0, which is always granted since the matrix can only hold affine transformations (all affine transformations are easily invertible).
We exploit the fact that the matrix is affine to speed things up.
Rotates the matrix by deg degrees in the xy-plane clockwise about the origin of the
Cartesian coordinate system.
Rotates the matrix by rad radian in the xy-plane clockwise about the origin of the
Cartesian coordinate system.
Applies a scaling to the matrix. If only sx is set and sy is undefined, we will scale x and y by sx.
A scale of 1 does not modify a dimension.
| sx 0 0 |
M' = M * | 0 sy 0 | | 0 0 1 |
Optionalsy: numberReturns the matrix's values as a CSS transform string.
Deeply converts this Record to equivalent native JavaScript Object.
Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.
Shallowly converts this Record to equivalent native JavaScript Object.
Shallowly converts this Record to equivalent JavaScript Object.
Multiplies current matrix values with a new transformation matrix.
The transformation will be applied on the left side of the multiplication,
so that they are applied in the order transform() is called.
| a' c' e' | | a2 c2 e2 | | a c e | | b' d' f' | = | b2 d2 f2 | * | b d f | | 0 0 1 | | 0 0 1 | | 0 0 1 |
Applies a translation to the matrix
| 1 0 tx |
M' = M * | 0 1 ty | | 0 0 1 |
Matrix for affine 2D transformations.
Layout:
| a c e | // - (a,b) the x base vector | b d f | // - (c,d) the y base vector | 0 0 1 | // - (e,f) the origin // of the resulting coordinate system.
The third row is always [0 0 1], thus we don't store the values.