DOMMatrix:invertSelf() 方法
注意:此功能在 Web Workers 中可用。
DOMMatrix 介面的 invertSelf() 方法將原始矩陣反轉。如果矩陣不可逆,新矩陣的所有分量都將設定為 NaN,並且其 is2D 屬性將設定為 false。
要反轉矩陣而不改變它,請參閱 DOMMatrixReadOnly.inverse()
語法
js
invertSelf()
引數
無。
返回值
一個 DOMMatrix。
示例
在此示例中,我們建立一個旋轉 30 度的矩陣。然後反轉它,得到一個旋轉 -30 度的矩陣。
js
const matrix = new DOMMatrix().rotate(30);
console.log(matrix.toString());
// output: matrix(0.866, 0.5, -0.5, 0.866, 0, 0)
matrix.invertSelf();
console.log(matrix.toString());
// output: matrix(0.866, -0.5, 0.5, 0.866, 0, 0)
規範
| 規範 |
|---|
| Geometry Interfaces Module Level 1 # dom-dommatrix-invertself |
瀏覽器相容性
載入中…
另見
DOMMatrixReadOnly.inverse()- CSS
matrix()函式 - CSS
matrix3d()函式