DOMMatrix:multiplySelf() 方法

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2020 年 1 月⁩ 起,所有主流瀏覽器均已支援。

注意:此功能在 Web Workers 中可用。

multiplySelf() 方法是 DOMMatrix 介面的一個方法,它將矩陣與 otherMatrix 引數相乘,計算原始矩陣與指定矩陣的點積:A⋅B。如果未指定乘數矩陣,則矩陣會乘以一個矩陣,該矩陣中除了右下角及其左上方和左側緊鄰的元素(m33m34)之外,所有元素均為 0。這些元素具有預設值 1

要相乘矩陣而不改變它,請參閱 DOMMatrixReadOnly.multiply()

語法

js
multiplySelf()
multiplySelf(otherMatrix)

引數

otherMatrix 可選

DOMMatrix 乘數。

返回值

返回自身;根據應用乘法的結果更新的 DOMMatrix

示例

js
const matrix = new DOMMatrix().rotate(30);

console.log(matrix.toString());
// output: matrix(0.866, 0.5, -0.5, 0.866, 0, 0)

matrix.multiplySelf(matrix);

console.log(matrix.toString());
// output: matrix(0.5, 0.866, -0.866, 0.5, 0, 0) (a 60deg rotation)

規範

規範
Geometry Interfaces Module Level 1
# dom-dommatrix-multiplyself

瀏覽器相容性

另見