The DOMMatrix
interface represents 4x4 matrices, suitable for 2D and 3D operations.
A 4x4 matrix is suitable to describe any rotation and translation in 3D.
This interface should be available inside Web workers, though some implementations don't allow it yet.
DOMMatrix()
This interface inherits properties from DOMMatrixReadOnly
, though some are modified not to be read-only.
is2D
Read only
A boolean
flag set to true if current matrix was initialized as a 2D matrixisIdentity
Read only
A boolean
flag returning true if the current matrix is identity.m11
, m12
, m13
, m14
, m21
, m22
, m23
, m24
, m31
, m32
, m33
, m34
, m41
, m42
, m43
, m44
double
representing each component of a 4x4 matrix.a
, b
, c
, d
, e
, f
double
representing each component of a 4x4 matrix needed for 2D rotations and translations. They are aliases for some components of the 4x4 matrix: 2D | 3D equivalent |
---|---|
a | m11 |
b | m12 |
c | m21 |
d | m22 |
e | m41 |
f | m42 |
This interface inherits methods from DOMMatrixReadOnly
.
DOMMatrixReadOnly.multiplySelf()
DOMMatrix
, with its new content being the result of the original matrix being multiplied by the given DOMMatrix
.DOMMatrixReadOnly.preMultiplySelf()
DOMMatrix
, with its new content being the result of the given DOMMatrix
being multiplied by the original matrix.DOMMatrix.translateSelf()
DOMMatrix
, with its new content being the result of the matrix being translated by the given vector.DOMMatrix.scaleSelf()
DOMMatrix
, with its new content being the result of the matrix x and y dimensions being scaled by the given factor, centered on the origin given.DOMMatrix.scale3dSelf()
DOMMatrix
, with its new content being the result of the matrix x, y and z dimension being scaled by the given factor, centered on the origin given.DOMMatrix.scaleNonUniformSelf()
DOMMatrix
, with its new content being the result of the matrix x, y and z dimension being scaled by the given factor for each dimension, centered on the origin given.DOMMatrix.rotateSelf()
DOMMatrix
, with its new content being the result of the original matrix being rotated by the given angle, with the rotation centered on the origin given.DOMMatrix.rotateFromVectorSelf()
DOMMatrix
, with its new content being the result of the original matrix being rotated by the angle between the given vector and (1,0), centered on the origin given.DOMMatrix.rotateAxisAngleSelf()
DOMMatrix
, with its new content being the result of the original matrix being rotated by the given angle and the give vector.DOMMatrix.skewXSelf()
DOMMatrix
, with its new content being the result of the original matrix being skewed along the x-axis by the given factor.DOMMatrix.skewYSelf()
DOMMatrix
, with its new content being the result of the original matrix being skewed along the y-axis by the given factor.DOMMatrix.invertSelf()
DOMMatrix
, with its new content being the result of the original matrix being inverted. If the matrix cannot be inverted, all its components are set to NaN
and is2D()
returns false
.DOMMatrix.setMatrixValue()
DOMMatrix
, with its describing the matrix representing the same transformation as the CSS transform
functions given in parameter.Specification | Status | Comment |
---|---|---|
Geometry Interfaces Module Level 1 The definition of 'DOMMatrix' in that specification. | Candidate Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 61 | No | 33 | No | 48 | No |
Support in web workers | 61 | No | No | No | 48 | No |
DOMMatrix() constructor |
61 | No | 33 | No | 48 | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 61 | 61 | No | 33 | 48 | No | ? |
Support in web workers | 61 | 61 | No | No | 48 | No | ? |
DOMMatrix() constructor |
61 | 61 | No | 33 | 48 | No | ? |
DOMMatrixReadOnly
SVGMatrix
, the SVG matrix intended to be superseded by DOMMatrix
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix