Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

DOMMatrix: Methode rotateSelf()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨Januar 2020⁩.

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Die rotateSelf()-Methode der DOMMatrix-Schnittstelle ist eine veränderbare Transformationsmethode, die eine Matrix modifiziert. Sie rotiert die Ursprungsmatrix 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 ä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 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

Siehe auch