Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
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. The elements are stored into the array as single-precision floating-point numbers in column-major (colexographical access, or "colex") order. (In other words, down the first column from top to bottom, then the second column, and so forth.)
For double-precision floating-point numbers, see DOMMatrixReadOnly.toFloat64Array().
None.
A Float32Array; an array of the matrix's 16 element values.
There are multiple ways to access the values of a matrix. This example rotates a matrix by 30deg, saving the rotated state as a JSON object using the DOMMatrixReadOnly.toJSON() method and as a single-precision array using the toFloat32Array() method.
| Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-tofloat32array |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Feb 2, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.