SVGPathElement: pathLength-Eigenschaft

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Die pathLength-Schreibgeschützte Eigenschaft des SVGPathElement-Interfaces spiegelt das pathLength-Attribut des gegebenen <path>-Elements wider.

Wert

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

Specification
SVG Paths
# __svg__SVGPathElement__pathLength

Browser-Kompatibilität

Siehe auch