DOMMatrixReadOnly: rotate()-Methode
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.
Hinweis: Diese Funktion ist in Web Workers verfügbar.
Die rotate()
-Methode des DOMMatrixReadOnly
-Interfaces gibt eine neue DOMMatrix
zurück, die durch das Rotieren der Ursprungsmatrix um jede ihrer Achsen um die angegebene Anzahl von Grad erstellt wurde. Die ursprüngliche Matrix wird nicht verändert.
Um die Matrix während der Rotation zu verändern, siehe DOMMatrix.rotateSelf()
.
Syntax
rotate()
rotate(rotX)
rotate(rotX, rotY)
rotate(rotX, rotY, rotZ)
Parameter
rotX
-
Eine Zahl; die x-Koordinate des Vektors, der die Rotationsachse angibt. Wenn ungleich null, ist
is2D
falsch. rotY
Optional-
Eine Zahl; die y-Koordinate des Vektors, der die Rotationsachse angibt. Wenn ungleich null, ist
is2D
falsch. rotZ
Optional-
Eine Zahl; die z-Koordinate des Vektors, der die Rotationsachse angibt.
Wenn nur rotX
übergeben wird, wird rotX
als Wert für die z-Koordinate verwendet, und die x- und y-Koordinate werden beide auf null gesetzt.
Rückgabewert
Eine DOMMatrix
.
Beispiele
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.toString());
// output: "matrix(1, 0, 0, 1, 0, 0)"
const rotated = matrix.rotate(30); // rotation and assignment
console.log(matrix.toString()); // original matrix is unchanged
// output: "matrix(1, 0, 0, 1, 0, 0)"
console.log(rotated.toString());
// output: "matrix(0.866, 0.5, -0.5, 0.866, 0, 0)"
Spezifikationen
Specification |
---|
Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-rotate |
Browser-Kompatibilität
BCD tables only load in the browser
Siehe auch
DOMMatrix.rotateSelf()
DOMMatrixReadOnly.rotateAxisAngle()
DOMMatrixReadOnly.rotateFromVector()
- CSS
transform
-Eigenschaft undrotate3d()
-Funktion - CSS
rotate
-Eigenschaft - CSS-Transformationen-Modul
- SVG
transform
-Attribut CanvasRenderingContext2D
-Interface undrotate()
-Methode