JavaScripture
Contribute via GitHub Feedback

DOMMatrixReadOnly : Object

A 4x4 matrix.

Constructors

new DOMMatrixReadOnly() : DOMMatrixReadOnly

Constructs new 2D identity matrix.

Example:

Run

Results:

 

new DOMMatrixReadOnly(cssTransform : String) : DOMMatrixReadOnly

Constructs a new matrix using the specified cssTransform. The syntax for this string is the same as for the css transform property.

Example:

Run

Results:

 

new DOMMatrixReadOnly(values : Iterator<Number>) : DOMMatrixReadOnly

values must have either 6 or 16 elements in it.

If 6 elements are specified (a, b, ..., f), the matrix will be a 2D matrix constructed like:

ace
bdf
001

Example:

Run

Results:

 

If 16 elements are specified (m11, m12, m13, m14, m21, m22, ..., m44), the matrix will be a 3D matrix constructed like:

m11m12m13m14
m21m22m23m24
m31m32m33m34
m41m42m43m44

Example:

Run

Results:

 

Instance Properties

a : Number  

Returns the a element of the matrix. This is the same as the m11 element.

Example:

Run

Results:

 

b : Number  

Returns the b element of the matrix. This is the same as the m12 element.

Example:

Run

Results:

 

c : Number  

Returns the c element of the matrix. This is the same as the m21 element.

Example:

Run

Results:

 

d : Number  

Returns the d element of the matrix. This is the same as the m22 element.

Example:

Run

Results:

 

e : Number  

Returns the e element of the matrix. This is the same as the m41 element.

Example:

Run

Results:

 

f : Number  

Returns the f element of the matrix. This is the same as the m42 element.

Example:

Run

Results:

 

is2D : Boolean  

Indicates this was created with one of the 2D constructors.

Example:

Run

Results:

 

isIdentity : Boolean  

true if this is an identity matrix (diagonal elements are 1, rest are 0).

Example:

Run

Results:

 

m11 : Number  

Returns the m11 element of the matrix. This is the same as the a element.

Example:

Run

Results:

 

m12 : Number  

Returns the m12 element of the matrix. This is the same as the b element.

Example:

Run

Results:

 

m13 : Number  

Returns the m13 element of the matrix.

Example:

Run

Results:

 

m14 : Number  

Returns the m14 element of the matrix.

Example:

Run

Results:

 

m21 : Number  

Returns the m21 element of the matrix. This is the same as the c element.

Example:

Run

Results:

 

m22 : Number  

Returns the m22 element of the matrix. This is the same as the d element.

Example:

Run

Results:

 

m23 : Number  

Returns the m23 element of the matrix.

Example:

Run

Results:

 

m24 : Number  

Returns the m24 element of the matrix.

Example:

Run

Results:

 

m31 : Number  

Returns the m31 element of the matrix.

Example:

Run

Results:

 

m32 : Number  

Returns the m32 element of the matrix.

Example:

Run

Results:

 

m33 : Number  

Returns the m33 element of the matrix.

Example:

Run

Results:

 

m34 : Number  

Returns the m14 element of the matrix.

Example:

Run

Results:

 

m41 : Number  

Returns the m41 element of the matrix. This is the same as the e element.

Example:

Run

Results:

 

m42 : Number  

Returns the m42 element of the matrix. This is the same as the f element.

Example:

Run

Results:

 

m43 : Number  

Returns the m43 element of the matrix.

Example:

Run

Results:

 

m44 : Number  

Returns the m44 element of the matrix.

Example:

Run

Results:

 

Instance Methods

flipX() : DOMMatrix

flipY() : DOMMatrix

inverse() : DOMMatrix
multiply 2 variants
multiply([matrix : Object]) : DOMMatrix

Same as multiyply(fromMatrix(matrix)).

multiply([matrix : DOMMatrixReadOnly]) : DOMMatrix
rotate 2 variants
rotate([degreesX = 0 : Number, [degreesY = 0 : Number, [degreesZ = 0 : Number]]]) : DOMMatrix
rotate(degreesZ = 0 : Number) : DOMMatrix
rotateAxisAngle([x = 0 : Number, [y = 0 : Number, [z = 0 : Number, [degrees = 0 : Number]]]]) : DOMMatrix
rotateFromVector([x = 0 : Number, [y = 0 : Number]]) : DOMMatrix

Rotates this by the angle between the x axis and the vector from the origin to the specified point (x, y). Same as this.rotate(Math.atan2(y, x) * 180 / Math.PI). See also DOMMatrix.rotateFromVectorSelf().

Example:

Run

Results:

 

scale([scaleX = 1 : Number, [scaleY = scaleX : Number, [scaleZ = 1 : Number, [originX = 0 : Number, [originY = 0 : Number, [originZ = 0 : Number]]]]]]) : DOMMatrix
scale3D([scale = 1 : Number, [originX = 0 : Number, [originY = 0 : Number, [originZ = 0 : Number]]]]) : DOMMatrix
scaleNonUniform([scaleX = 1 : Number, [scaleY = 1 : Number]]) : DOMMatrix

skewX([degrees = 0 : Number]) : DOMMatrix

See also DOMMatrix.skewXSelf().

Example:

Run

Results:

 

skewY([degrees = 0 : Number]) : DOMMatrix

See also DOMMatrix.skewYSelf().

Example:

Run

Results:

 

toFloat32Array() : Float32Array

toFloat64Array() : Float64Array

transformPoint 2 variants
transformPoint([point : DOMPointReadOnly]) : DOMPoint

transformPoint(point : Object) : DOMPoint

Same as transformPoint(fromPoint(Point)).

translate([x : Number, [y : Number, [z : Number]]]) : DOMMatrix

Returns a new DOMMatrix of this followed by the specified translation. If this is 2D and z is specified, the return value will be a 3D matrix. Otherwise it will be a 2D matrix. See also DOMMatrix.translateSelf().

Example:

Run

Results:

 

DOMMatrixReadOnly Methods

fromFloat32Array(values : Float32Array) : DOMMatrixReadOnly

fromFloat64Array(values : Float64Array) : DOMMatrixReadOnly

fromMatrix 2 variants
fromMatrix([matrix : DOMMatrixReadOnly]) : DOMMatrixReadOnly

fromMatrix(init : Object) : DOMMatrixReadOnly