The DOMMatrix interface represents 4x4 matrices, suitable for 2D and 3D operations.

Documentation DOMMatrix by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Constructor

new(numberSequence:Array<Float>)

new()

new(transformList:String)

new(other:DOMMatrixReadOnly)

new(array32:Float32Array)

new(array64:Float64Array)

Throws:

null

DOMError

Methods

invertSelf():DOMMatrix

Returns itself,  a 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.

rotateAxisAngleSelf(x:Float, y:Float, z:Float, angle:Float):DOMMatrix

Returns itself, a DOMMatrix, with its new content being the result of the original matrix being rotated by the given angle and the give vector.

rotateFromVectorSelf(x:Float, y:Float):DOMMatrix

Returns itself, a 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.

@:value({ originY : 0.0, originX : 0.0 })rotateSelf(angle:Float, originX:Float = 0.0, originY:Float = 0.0):DOMMatrix

Returns itself, a 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.

@:value({ originZ : 0.0, originY : 0.0, originX : 0.0 })scale3dSelf(scale:Float, originX:Float = 0.0, originY:Float = 0.0, originZ:Float = 0.0):DOMMatrix

Returns itself, a 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.

@:value({ originZ : 0.0, originY : 0.0, originX : 0.0, scaleZ : 1.0, scaleY : 1.0 })scaleNonUniformSelf(scaleX:Float, scaleY:Float = 1.0, scaleZ:Float = 1.0, originX:Float = 0.0, originY:Float = 0.0, originZ:Float = 0.0):DOMMatrix

Returns itself, a 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.

@:value({ originY : 0.0, originX : 0.0 })scaleSelf(scale:Float, originX:Float = 0.0, originY:Float = 0.0):DOMMatrix

Returns itself, a 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.

setMatrixValue(transformList:String):DOMMatrix

Returns itself, a DOMMatrix, with its describing the matrix representing the same transformation as the CSS transform functions given in parameter.

Throws:

null

DOMError

skewXSelf(sx:Float):DOMMatrix

Returns itself, a DOMMatrix, with its new content being the result of the original matrix being skewed along the x-axis by the given factor.

skewYSelf(sy:Float):DOMMatrix

Returns itself, a DOMMatrix, with its new content being the result of the original matrix being skewed along the y-axis by the given factor.

@:value({ tz : 0.0 })translateSelf(tx:Float, ty:Float, tz:Float = 0.0):DOMMatrix

Returns itself, a DOMMatrix, with its new content being the result of the matrix being translated by the given vector.

Inherited Variables

Defined by DOMMatrixReadOnly

read onlya:Float

Are double representing each component of a 4x4 matrix needed for 2D rotations and translations. They are aliases for some components of the 4x4 matrix:

	<tr>
		2D
		3D equivalent
	</tr>


	<tr>
		<td><code>a</code></td>
		<td><code>m11</code></td>
	</tr>
	<tr>
		<td><code>b</code></td>
		<td><code>m12</code></td>
	</tr>
	<tr>
		<td><code>c</code></td>
		<td><code>m21</code></td>
	</tr>
	<tr>
		<td><code>d</code></td>
		<td><code>m22</code></td>
	</tr>
	<tr>
		<td><code>e</code></td>
		<td><code>m41</code></td>
	</tr>
	<tr>
		<td><code>f</code></td>
		<td><code>m42</code></td>
	</tr>

They are read-only, but their counterpart, with the same name, in DOMMatrix aren't.

read onlyb:Float

read onlyc:Float

read onlyd:Float

read onlye:Float

read onlyf:Float

read onlyis2D:Bool

Is a Boolean indicating if the matrix contains a 2D matrix and only accept 2D transformations.

read onlyisIdentity:Bool

Is a Boolean indincating if the matrix identity, that is a matrix with 1 on the components of its diagonal, and 0 elsewhere.

read onlym11:Float

Are double representing each component of a 4x4 matrix. They are read-only, but their counterpart, with the same name, in DOMMatrix aren't.

read onlym12:Float

read onlym13:Float

read onlym14:Float

read onlym21:Float

read onlym22:Float

read onlym23:Float

read onlym24:Float

read onlym31:Float

read onlym32:Float

read onlym33:Float

read onlym34:Float

read onlym41:Float

read onlym42:Float

read onlym43:Float

read onlym44:Float

Inherited Methods

Defined by DOMMatrixReadOnly

flipX():DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being flipped around the x-axis, that is multiplied by the DOMMatrix(-1, 0, 0, 1, 0, 0). The original matrix is not modified.

flipY():DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being flipped around the y-axis, that is multiplied by the DOMMatrix(1, 0, 0, -1, 0, 0). The original matrix is not modified.

inverse():DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being inverted. The original matrix is not modified. If the matrix cannot be inverted, all its components are set to NaN and is2D() returns false.

multiply(other:DOMMatrix):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being multiplied by the given DOMMatrix. The original matrix is not modified.

@:value({ originY : 0.0, originX : 0.0 })rotate(angle:Float, originX:Float = 0.0, originY:Float = 0.0):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being rotated by the given angle, with the rotation centered on the origin given. The original matrix is not modified.

rotateAxisAngle(x:Float, y:Float, z:Float, angle:Float):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being rotated by the given angle and the given vector. The original matrix is not modified.

rotateFromVector(x:Float, y:Float):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being rotated by the angle between the given vector and (1,0), centered on the origin given. The original matrix is not modified.

@:value({ originY : 0.0, originX : 0.0 })scale(scale:Float, originX:Float = 0.0, originY:Float = 0.0):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the matrix x and y dimensions being scaled by the given factor, centered on the origin given. The original matrix is not modified.

@:value({ originZ : 0.0, originY : 0.0, originX : 0.0 })scale3d(scale:Float, originX:Float = 0.0, originY:Float = 0.0, originZ:Float = 0.0):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the matrix x, y and z dimension being scaled by the given factor, centered on the origin given. The original matrix is not modified.

@:value({ originZ : 0.0, originY : 0.0, originX : 0.0, scaleZ : 1.0, scaleY : 1.0 })scaleNonUniform(scaleX:Float, scaleY:Float = 1.0, scaleZ:Float = 1.0, originX:Float = 0.0, originY:Float = 0.0, originZ:Float = 0.0):DOMMatrix

Returns a DOMMatrix containing a new matrix 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. The original matrix is not modified.

skewX(sx:Float):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being skewed along the x-axis by the given factor. The original matrix is not modified.

skewY(sy:Float):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the original matrix being skewed along the y-axis by the given factor. The original matrix is not modified.

toFloat32Array():Float32Array

Returns a Float32Array containing the 6 components (a, b, c, d, e, f) in the case of a 2D matrix or the 16 components (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) for a 3D matrix.

Throws:

null

DOMError

toFloat64Array():Float64Array

Returns a Float64Array containing the 6 components (a, b, c, d, e, f) in the case of a 2D matrix or the 16 components (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) for a 3D matrix.

Throws:

null

DOMError

toJSON():Dynamic

Returns a JSON representation of the DOMMatrixReadOnly object.

transformPoint(?point:Null<DOMPointInit>):DOMPoint

Returns a DOMPoint that is the point given in parameter multiplied by the matrix. But the original point and the matrix aren't modified.

@:value({ tz : 0.0 })translate(tx:Float, ty:Float, tz:Float = 0.0):DOMMatrix

Returns a DOMMatrix containing a new matrix being the result of the matrix being translated by the given vector. The original matrix is not modified.