Function: calculatePathLength()
calculatePathLength(
path,steps?):number
Defined in: attributes/shape/path/length.ts:21
Estimates the total length of an SVG path by walking its commands and summing
each segment's length. Straight segments (L/H/V/Z) are measured exactly; curves
(C/S/Q/T) are flattened into steps line segments and summed.
Arcs (A/a) are approximated as a straight chord — see the note in the A/a case. For exact arc lengths, convert arcs to cubic Béziers before calling this.
Parameters
path
Path commands to measure (absolute or relative).
steps?
number = 20
Flattening resolution for curved segments. Higher is more accurate.
Returns
number