此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

DOMMatrixReadOnly:DOMMatrixReadOnly() 构造函数

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2020年1月⁩.

备注: 此特性在 Web Worker 中可用。

DOMMatrixReadOnly 构造函数创建一个新的表示适合于二维和三维操作的 4x4 矩阵的 DOMMatrixReadOnly 对象。

语法

js
DOMMatrixReadOnly()
DOMMatrixReadOnly(init)

参数

init 可选

包含数字序列的字符串或指定要创建的矩阵的数字数组。

如果传递数字数组,则行为取决于数组的长度:

  • 对于形式为 [a, b, c, d, e, f] 的 6 元素数组,将创建一个二维只读矩阵,并使用提供的元素进行初始化。
  • 对于形式为 [m11, m12, m13, …, m42, m43, m44] (按列优先顺序)的 16 元素数组,将创建一个三维只读矩阵,并使用提供的元素进行初始化。

规范

Specification
Geometry Interfaces Module Level 1
# dom-dommatrixreadonly-dommatrixreadonly

浏览器兼容性