DOMMatrix: rotateAxisAngleSelf() 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 rotateAxisAngleSelf()-Methode der DOMMatrix-Schnittstelle ist eine Transformationsmethode, die die Quellmatrix um den angegebenen Vektor und Winkel dreht und die veränderte Matrix zurückgibt.

Um eine Matrix zu drehen, ohne sie zu verändern, siehe DOMMatrixReadOnly.rotateAxisAngle(), die eine neue gedrehte Matrix erstellt, während das Original unverändert bleibt.

Syntax

js
rotateAxisAngleSelf()
rotateAxisAngleSelf(rotX)
rotateAxisAngleSelf(rotX, rotY)
rotateAxisAngleSelf(rotX, rotY, rotZ)
rotateAxisAngleSelf(rotX, rotY, rotZ, angle)

Parameter

rotX

Eine Zahl; die x-Koordinate des Vektors, der die Rotationsachse angibt. Wenn ungleich null, ist is2D false.

rotY Optional

Eine Zahl; die y-Koordinate des Vektors, der die Rotationsachse angibt. Wenn undefiniert, wird der Wert von rotX verwendet. Wenn ungleich null, ist is2D false.

rotZ Optional

Eine Zahl; die z-Koordinate des Vektors, der die Rotationsachse angibt. Wenn undefiniert, wird der Wert von rotX verwendet.

angle Optional

Eine Zahl; der Winkel der Rotation um den Achsenvektor, in Grad.

Wenn rotY und rotZ beide fehlen, wird rotZ auf den Wert von rotX gesetzt, und sowohl rotX als auch rotY sind 0.

Rückgabewert

Eine DOMMatrix.

Beispiele

js
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.rotateAxisAngleSelf(10, 20, 30, 45).toString());
/* "matrix3d(
    0.728, 0.609, -0.315, 0, 
    -0.525, 0.791, 0.315, 0, 
    0.441, -0.063, 0.895, 
    0, 0, 0, 0, 1)" */
console.log(matrix.toString());
/* "matrix3d(
    0.728, 0.609, -0.315, 0, 
    -0.525, 0.791, 0.315, 0, 
    0.441, -0.063, 0.895, 0, 
    0, 0, 0, 1)" */

Spezifikationen

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

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
rotateAxisAngleSelf

Legend

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

Full support
Full support

Siehe auch