DOMMatrix

open class DOMMatrix(init: String = definedExternally) : DOMMatrixReadOnly, Serializable(source)

The DOMMatrix interface represents 4×4 matrices, suitable for 2D and 3D operations including rotation and translation.

MDN Reference

Constructors

Link copied to clipboard
constructor(init: ReadonlyArray<JsDouble>)
constructor(init: String = definedExternally)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override var a: Double
Link copied to clipboard
open override var b: Double
Link copied to clipboard
open override var c: Double
Link copied to clipboard
open override var d: Double
Link copied to clipboard
open override var e: Double
Link copied to clipboard
open override var f: Double
Link copied to clipboard
open val is2D: Boolean

The readonly is2D property of the DOMMatrixReadOnly interface is a Boolean flag that is true when the matrix is 2D.

Link copied to clipboard

The readonly isIdentity property of the DOMMatrixReadOnly interface is a Boolean whose value is true if the matrix is the identity matrix.

Link copied to clipboard
open override var m11: Double
Link copied to clipboard
open override var m12: Double
Link copied to clipboard
open override var m13: Double
Link copied to clipboard
open override var m14: Double
Link copied to clipboard
open override var m21: Double
Link copied to clipboard
open override var m22: Double
Link copied to clipboard
open override var m23: Double
Link copied to clipboard
open override var m24: Double
Link copied to clipboard
open override var m31: Double
Link copied to clipboard
open override var m32: Double
Link copied to clipboard
open override var m33: Double
Link copied to clipboard
open override var m34: Double
Link copied to clipboard
open override var m41: Double
Link copied to clipboard
open override var m42: Double
Link copied to clipboard
open override var m43: Double
Link copied to clipboard
open override var m44: Double

Functions

Link copied to clipboard

The flipX() method of the DOMMatrixReadOnly interface creates a new matrix being the result of the original matrix flipped about the x-axis.

Link copied to clipboard

The flipY() method of the DOMMatrixReadOnly interface creates a new matrix being the result of the original matrix flipped about the y-axis.

Link copied to clipboard

The inverse() method of the DOMMatrixReadOnly interface creates a new matrix which is the inverse of the original matrix.

Link copied to clipboard

The invertSelf() method of the DOMMatrix interface inverts the original matrix.

Link copied to clipboard
fun multiply(other: DOMMatrixReadOnly = definedExternally): DOMMatrix

The multiply() method of the DOMMatrixReadOnly interface creates and returns a new matrix which is the dot product of the matrix and the otherMatrix parameter.

Link copied to clipboard
fun multiplySelf(other: DOMMatrixReadOnly = definedExternally): DOMMatrix

The 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.

Link copied to clipboard
fun preMultiplySelf(other: DOMMatrixReadOnly = definedExternally): DOMMatrix

The preMultiplySelf() method of the DOMMatrix interface modifies the matrix by pre-multiplying it with the specified DOMMatrix.

Link copied to clipboard
fun rotate(rotX: Double = definedExternally, rotY: Double = definedExternally, rotZ: Double = definedExternally): DOMMatrix

The rotate() method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by rotating the source matrix around each of its axes by the specified number of degrees.

Link copied to clipboard
fun rotateAxisAngle(    x: Double = definedExternally,     y: Double = definedExternally,     z: Double = definedExternally,     angle: Double = definedExternally): DOMMatrix

The rotateAxisAngle() method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by rotating the source matrix by the given vector and angle.

Link copied to clipboard
fun rotateAxisAngleSelf(    x: Double = definedExternally,     y: Double = definedExternally,     z: Double = definedExternally,     angle: Double = definedExternally): DOMMatrix

The 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.

Link copied to clipboard
fun rotateFromVector(x: Double = definedExternally, y: Double = definedExternally): DOMMatrix

The rotateFromVector() method of the DOMMatrixReadOnly interface is returns a new DOMMatrix created by rotating the source matrix by the angle between the specified vector and (1, 0).

Link copied to clipboard
fun rotateFromVectorSelf(x: Double = definedExternally, y: Double = definedExternally): DOMMatrix

The 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).

Link copied to clipboard
fun rotateSelf(rotX: Double = definedExternally, rotY: Double = definedExternally, rotZ: Double = definedExternally): DOMMatrix

The rotateSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix.

Link copied to clipboard
fun scale(    scaleX: Double = definedExternally,     scaleY: Double = definedExternally,     scaleZ: Double = definedExternally,     originX: Double = definedExternally,     originY: Double = definedExternally,     originZ: Double = definedExternally): DOMMatrix

The scale() method of the original matrix with a scale transform applied.

Link copied to clipboard
fun scale3d(    scale: Double = definedExternally,     originX: Double = definedExternally,     originY: Double = definedExternally,     originZ: Double = definedExternally): DOMMatrix

The scale3d() method of the DOMMatrixReadOnly interface creates a new matrix which is the result of a 3D scale transform being applied to the matrix.

Link copied to clipboard
fun scale3dSelf(    scale: Double = definedExternally,     originX: Double = definedExternally,     originY: Double = definedExternally,     originZ: Double = definedExternally): DOMMatrix

The 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.

Link copied to clipboard
fun scaleSelf(    scaleX: Double = definedExternally,     scaleY: Double = definedExternally,     scaleZ: Double = definedExternally,     originX: Double = definedExternally,     originY: Double = definedExternally,     originZ: Double = definedExternally): DOMMatrix

The 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.

Link copied to clipboard
fun setMatrixValue(transformList: String): DOMMatrix

The setMatrixValue() method of the DOMMatrix interface replaces the contents of the matrix with the matrix described by the specified transform or transforms, returning itself.

Link copied to clipboard
fun skewX(sx: Double = definedExternally): DOMMatrix

The skewX() method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its x-axis.

Link copied to clipboard
fun skewXSelf(sx: Double = definedExternally): DOMMatrix

The skewXSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix.

Link copied to clipboard
fun skewY(sy: Double = definedExternally): DOMMatrix

The skewY() method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its y-axis.

Link copied to clipboard
fun skewYSelf(sy: Double = definedExternally): DOMMatrix

The skewYSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix.

Link copied to clipboard

The toFloat32Array() method of the DOMMatrixReadOnly interface returns a new Float32Array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix.

Link copied to clipboard

The toFloat64Array() method of the DOMMatrixReadOnly interface returns a new Float64Array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix.

Link copied to clipboard
fun toJSON(): JsAny

The toJSON() method of the DOMMatrixReadOnly interface creates and returns a JSON object.

Link copied to clipboard
fun transformPoint(point: DOMPointReadOnly = definedExternally): DOMPoint

The transformPoint method of the You can also create a new DOMPoint by applying a matrix to a point with the DOMPointReadOnly.matrixTransform() method.

Link copied to clipboard
fun translate(tx: Double = definedExternally, ty: Double = definedExternally, tz: Double = definedExternally): DOMMatrix

The translate() method of the DOMMatrixReadOnly interface creates a new matrix being the result of the original matrix with a translation applied.

Link copied to clipboard
fun translateSelf(tx: Double = definedExternally, ty: Double = definedExternally, tz: Double = definedExternally): DOMMatrix

The translateSelf() method of the DOMMatrix interface is a mutable transformation method that modifies a matrix.