DOMMatrix:multiplySelf() 方法
注意:此功能在 Web Workers 中可用。
multiplySelf()
方法是 DOMMatrix
接口的一个方法,它将矩阵与 otherMatrix
参数相乘,计算原始矩阵与指定矩阵的点积:A⋅B
。如果未指定乘数矩阵,则矩阵会乘以一个矩阵,该矩阵中除了右下角及其左上方和左侧紧邻的元素(m33
和 m34
)之外,所有元素均为 0
。这些元素具有默认值 1
。
要相乘矩阵而不改变它,请参阅 DOMMatrixReadOnly.multiply()
。
语法
js
multiplySelf()
multiplySelf(otherMatrix)
参数
返回值
返回自身;根据应用乘法的结果更新的 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 |
浏览器兼容性
加载中…
另见
DOMMatrixReadOnly.multiply()
DOMMatrix.preMultiplySelf()
- CSS
matrix()
函数 - CSS
matrix3d()
函数