DOMMatrix
interface · experimental
interface DOMMatrix extends DOMMatrixReadOnlyThe DOMMatrix interface represents 4×4 matrices, suitable for 2D and 3D operations including rotation and translation. It is a mutable version of the DOMMatrixReadOnly interface. The interface is available inside web workers.
| m11 m21 m31 m41 |
| m12 m22 m32 m42 |
| m13 m23 m33 m43 |
| m14 m24 m34 m44 |
variable · experimental
var DOMMatrix: { … }The DOMMatrix interface represents 4×4 matrices, suitable for 2D and 3D operations including rotation and translation. It is a mutable version of the DOMMatrixReadOnly interface. The interface is available inside web workers.
| m11 m21 m31 m41 |
| m12 m22 m32 m42 |
| m13 m23 m33 m43 |
| m14 m24 m34 m44 |
Constructors
constructor
new DOMMatrix(init?: string | number[]): DOMMatrixProperties
a
a: number
b
b: number
c
c: number
d
d: number
e
e: number
f
f: number
m11
m11: number
m12
m12: number
m13
m13: number
m14
m14: number
m21
m21: number
m22
m22: number
m23
m23: number
m24
m24: number
m31
m31: number
m32
m32: number
m33
m33: number
m34
m34: number
m41
m41: number
m42
m42: number
m43
m43: number
m44
m44: number
prototype
prototype: DOMMatrixMethods
invertSelf
invertSelf(): DOMMatrixThe invertSelf() method of the DOMMatrix interface inverts the original matrix. If the matrix cannot be inverted, the new matrix's components are all set to NaN and its is2D property is set to false.
multiplySelf
multiplySelf(other?: DOMMatrixInit): DOMMatrixThe multiplySelf() method of the DOMMatrix interface multiplies a matrix by the otherMatrix parameter, computing the dot product of the original matrix and the specified matrix: A⋅B. If no matrix is specified as the multiplier, the matrix is multiplied by a matrix in which every element is 0 except the bottom-right corner and the element immediately above and to its left: m33 and m34. These have the default value of 1.
preMultiplySelf
preMultiplySelf(other?: DOMMatrixInit): DOMMatrixThe preMultiplySelf() method of the DOMMatrix interface modifies the matrix by pre-multiplying it with the specified DOMMatrix. This is equivalent to the dot product B⋅A, where matrix A is the source matrix and B is the matrix given as an input to the method. If no matrix is specified as the multiplier, the matrix is multiplied by a matrix in which every element is 0 except the bottom-right corner and the element immediately above and to its left: m33 and m34. These have the default value of 1.
rotateAxisAngleSelf
rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrixThe rotateAxisAngleSelf() method of the DOMMatrix interface is a transformation method that rotates the source matrix by the given vector and angle, returning the altered matrix.
rotateFromVectorSelf
rotateFromVectorSelf(x?: number, y?: number): DOMMatrixThe rotateFromVectorSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix by rotating the matrix by the angle between the specified vector and (1, 0). The rotation angle is determined by the angle between the vector (1,0)T and (x,y)T in the clockwise direction, or (+/-)arctan(y/x). If x and y are both 0, the angle is specified as 0, and the matrix is not altered.
rotateSelf
rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrixThe rotateSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. It rotates the source matrix around each of its axes by the specified number of degrees and returns the rotated matrix.
scale3dSelf
scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrixThe scale3dSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix by applying a specified scaling factor to all three axes, centered on the given origin, with a default origin of (0, 0, 0), returning the 3D-scaled matrix.
scaleSelf
scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrixThe scaleSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix by applying a specified scaling factor, centered on the given origin, with a default origin of (0, 0), returning the scaled matrix.
setMatrixValue
setMatrixValue(transformList: string): DOMMatrixThe setMatrixValue() method of the DOMMatrix interface replaces the contents of the matrix with the matrix described by the specified transform or transforms, returning itself.
skewXSelf
skewXSelf(sx?: number): DOMMatrixThe skewXSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. It skews the source matrix by applying the specified skew transformation along the X-axis and returns the skewed matrix.
skewYSelf
skewYSelf(sy?: number): DOMMatrixThe skewYSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. It skews the source matrix by applying the specified skew transformation along the Y-axis and returns the skewed matrix.
translateSelf
translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrixThe translateSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. It applies the specified vectors and returns the updated matrix. The default vector is [0, 0, 0].
fromFloat32Array
fromFloat32Array(array32: Float32Array<ArrayBuffer>): DOMMatrixThe fromFloat32Array() static method of the DOMMatrix interface creates a new DOMMatrix object given an array of single-precision (32-bit) floating-point values.
fromFloat64Array
fromFloat64Array(array64: Float64Array<ArrayBuffer>): DOMMatrixThe fromFloat64Array() static method of the DOMMatrix interface creates a new DOMMatrix object given an array of double-precision (64-bit) floating-point values.
fromMatrix
fromMatrix(other?: DOMMatrixInit): DOMMatrixThe fromMatrix() static method of the DOMMatrix interface creates a new DOMMatrix object given an existing matrix or an object which provides the values for its properties.