DOMMatrix: rotateSelf() 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 rotateSelf()-Methode des DOMMatrix-Interfaces ist eine veränderliche Transformationsmethode, die eine Matrix modifiziert. Sie rotiert die Ausgangsmatrix um jede ihrer Achsen um die angegebene Anzahl von Grad und gibt die gedrehte Matrix zurück.

Um eine Matrix zu drehen, ohne sie zu verändern, siehe DOMMatrixReadOnly.rotate().

Syntax

js
rotateSelf()
rotateSelf(rotX)
rotateSelf(rotX, rotY)
rotateSelf(rotX, rotY, rotZ)

Parameter

rotX

Eine Zahl; die x-Koordinate des Vektors, der die Rotationsachse angibt.

rotY Optional

Eine Zahl; die y-Koordinate des Vektors, der die Rotationsachse angibt.

rotZ Optional

Eine Zahl; die z-Koordinate des Vektors, der die Rotationsachse angibt.

Wenn nur ein Parameter übergeben wird, ist rotZ der Wert von rotX, und sowohl rotX als auch rotY sind 0, und die Rotation ist eine 2D-Rotation. Wenn rotX und rotY ungleich null sind, ist der is2D false.

Rückgabewert

Gibt sich selbst zurück; die durch die angegebenen Vektoren gedrehte DOMMatrix.

Beispiele

js
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.toString()); // output: "matrix(1, 0, 0, 1, 0, 0)"
matrix.rotateSelf(30); // mutate it
console.log(matrix); // output: "matrix(0.866, 0.5, -0.5, 0.866, 0, 0)"

Spezifikationen

Specification
Geometry Interfaces Module Level 1
# dom-dommatrix-rotateself

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
rotateSelf

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch