SVGPathElement: pathLength-Eigenschaft - Web-APIs | MDN

Wert

Ein SVGAnimatedNumber.

Beispiele

Zugriff auf die pathLength-Eigenschaft

html

<svg width="200" height="100">
  <path id="myPath" d="M 0,30 h100" pathLength="50" />
</svg>

js

const pathElement = document.getElementById("myPath");

// Access the pathLength property
const animatedNumber = pathElement.pathLength;

// The base value of the pathLength attribute
console.log(animatedNumber.baseVal); // Output: 100

Spezifikationen

Spezifikation
SVG Paths
# __svg__SVGPathElement__pathLength

Browser-Kompatibilität

Siehe auch

Help improve MDN

Erfahren Sie, wie Sie beitragen können Diese Seite wurde automatisch aus dem Englischen übersetzt.