DOMMatrixReadOnly: toString() 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.
Der toString()
-String-Erzeuger des DOMMatrixReadOnly
Interfaces gibt den Wert der Matrix als Zeichenkette in Form einer matrix()
oder matrix3d()
CSS-Transformationsfunktion zurück; kommagetrennte Listen von 6 oder 16 Koordinatenwerten, die jeweils mit "matrix(
oder "matrix3d(
beginnen und mit )"
enden.
Bei einer 2D-Matrix werden die Elemente a
bis f
aufgelistet, insgesamt sechs Werte in der Form matrix(a, b, c, d, e, f)
. Details zu dieser Syntax finden Sie in der matrix()
CSS-Funktion.
Für eine 3D-Matrix enthält die zurückgegebene Zeichenkette alle 16 Elemente und hat die Form matrix3d(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
. Einzelheiten zur Syntax dieser 3D-Notation finden Sie in der matrix3d()
CSS-Funktion.
Syntax
toString()
Parameter
Keine.
Rückgabewert
Eine Zeichenkette; die Werte der Liste durch Kommas getrennt, in der Syntax der matrix()
oder matrix3d()
Funktion.
Beispiele
const matrix = new DOMMatrixReadOnly();
console.log(matrix.translate(20, 30).toString()); // matrix(1, 0, 0, 1, 20, 30)
console.log(matrix.translate(30, 40, 50).toString()); // matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 30, 40, 50, 1)
console.log(matrix.skewY(15).skewX(5).rotate(3).translate(20, 50).toString());
// matrix(1.003, 0.321, 0.035, 1.01, 21.816, 56.824)
console.log(
matrix.skewY(15).skewX(5).rotate(3).translate(20, 50, 60).toString(),
);
// matrix3d(1.003, 0.321, 0, 0, 0.0350, 1.008, 0, 0, 0, 0, 1, 0, 21.816, 56.824, 60, 1)
Spezifikationen
No specification found
No specification data found for api.DOMMatrixReadOnly.toString
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
toString() |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support