SVGTransform: type-Eigenschaft

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.

Die type-nur lesbare Eigenschaft der SVGTransform-Schnittstelle gibt den Typ der Transformation an, der durch eine der auf dieser Schnittstelle definierten SVG_TRANSFORM_*-Konstanten spezifiziert ist.

Wert

Ein integer; der Typ des Wertes als unsigned short.

Beispiele

Bestimmung des Typs einer Transformation

html
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
  <rect id="rect" x="50" y="50" width="100" height="100" fill="blue" />
</svg>
js
const rect = document.getElementById("rect");
const transformList = rect.transform.baseVal;

// Create and add a translation transform
const translateTransform = rect.ownerSVGElement.createSVGTransform();
translateTransform.setTranslate(20, 30);
transformList.appendItem(translateTransform);

// Check the type of the added transform
console.log(transformList.getItem(0).type); // Output: 2 (SVG_TRANSFORM_TRANSLATE)

Spezifikationen

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGTransform__type

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
type

Legend

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

Full support
Full support