DOMMatrix: multiplySelf() メソッド
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月.
メモ: この機能はウェブワーカー内で利用可能です。
multiplySelf() は DOMMatrix インターフェイスのメソッドで、行列を otherMatrix 引数で乗算し、元の行列と指定された行列のドット積 (A⋅B) を計算します。乗数として行列が指定されなかった場合、行列は右下隅と、その直上かつ左隣の要素(m33 と m34)を除き、すべての要素が 0 である行列と乗算されます。これらの要素はデフォルト値 1 を持ちます。
変化させずに行列を乗算する場合は、DOMMatrixReadOnly.multiply() を参照してください。
構文
js
multiplySelf()
multiplySelf(otherMatrix)
引数
otherMatrix省略可-
乗算する
DOMMatrixです。
返値
自分自身を返します。適用された乗算の結果に更新された DOMMatrix です。
例
js
const matrix = new DOMMatrix().rotate(30);
console.log(matrix.toString());
// 出力: matrix(0.866, 0.5, -0.5, 0.866, 0, 0)
matrix.multiplySelf(matrix);
console.log(matrix.toString());
// 出力: matrix(0.5, 0.866, -0.866, 0.5, 0, 0) (60 度の回転)
仕様書
| Specification |
|---|
| Geometry Interfaces Module Level 1> # dom-dommatrix-multiplyself> |
ブラウザーの互換性
関連情報
DOMMatrixReadOnly.multiply()DOMMatrix.preMultiplySelf()- CSS の
matrix()関数 - CSS の
matrix3d()関数