SVGPathElement: pathLength property
ThepathLength read-only property of theSVGPathElement interface reflects thepathLength attribute of the given<path> element.
In this article
Value
Examples
>Accessing thepathLength Property
html
<svg width="200" height="100"> <path d="M 0,30 h100" pathLength="50" /></svg>js
const pathElement = document.getElementById("myPath");// Access the pathLength propertyconst animatedNumber = pathElement.pathLength;// The base value of the pathLength attributeconsole.log(animatedNumber.baseVal); // Output: 100Specifications
| Specification |
|---|
| SVG Paths> # __svg__SVGPathElement__pathLength> |