pathLength

This attribute lets the author specify a total length for the path, in whatever units the author chooses. This value is then used to calibrate the browser's distance calculations with those of the author, by scaling all distance computations using the ratio pathLength / (computed value of path length).

This can affect the actual rendered lengths of paths, including text paths, animation paths, and various stroke operations.

Example

Source code

Output result

Unable to find file pathLength.svg

Unable to find file pathLength.svg

The primary thing to note here is that this example is using pathLength to tell the SVG renderer that the path is 200 units long, even though it's only 100 CSS pixels long. This, in combination with the 100-pixel on/100-pixel off dash stroke leads the stroke to appear to use only half the length of the real path.