DOMMatrix: rotateSelf() method
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available in Web Workers.
Phương thức rotateSelf() của giao diện DOMMatrix là phương thức biến đổi có thể thay đổi, sửa đổi một ma trận. Nó xoay ma trận nguồn quanh từng trục theo số độ được chỉ định và trả về ma trận đã được xoay.
Để xoay ma trận mà không làm thay đổi nó, hãy xem DOMMatrixReadOnly.rotate()
Cú pháp
rotateSelf()
rotateSelf(rotX)
rotateSelf(rotX, rotY)
rotateSelf(rotX, rotY, rotZ)
Tham số
rotX-
Một số; tọa độ x của vectơ biểu thị trục xoay.
rotYOptional-
Một số; tọa độ y của vectơ biểu thị trục xoay.
rotZOptional-
Một số; tọa độ z của vectơ biểu thị trục xoay.
Nếu chỉ một tham số được truyền vào, rotZ là giá trị của rotX, và cả rotX lẫn rotY đều là 0, và phép xoay là xoay 2D. Nếu rotX và rotY khác không, is2D là false.
Giá trị trả về
Trả về chính nó; DOMMatrix đã được xoay theo các vectơ cho trước.
Ví dụ
const matrix = new DOMMatrix(); // tạo một ma trận
console.log(matrix.toString()); // output: "matrix(1, 0, 0, 1, 0, 0)"
matrix.rotateSelf(30); // thay đổi nó
console.log(matrix); // output: "matrix(0.866, 0.5, -0.5, 0.866, 0, 0)"
Thông số kỹ thuật
| Specification |
|---|
| Geometry Interfaces Module Level 1> # dom-dommatrix-rotateself> |
Tương thích trình duyệt
Xem thêm
DOMMatrixReadOnly.rotate()- CSS
transformproperty - CSS
rotateproperty - CSS
<transform-function>functions - CSS transforms module
- SVG
transformattribute CanvasRenderingContext2Dinterface methods