Skip to main content

Function: extractSubpath()

extractSubpath(d, start, end): PathData

Defined in: attributes/shape/path/subpath.ts:472

Returns the portion of a path between the normalized arc-length fractions start and end (both 0..1), as a fresh command list. This is what drives a "trim path" / draw-on animation.

Fast paths: a full 0..1 range, a string d (already opaque), or an empty path are returned unchanged; an empty/inverted range returns [].

Parameters

d

PathData

Source path (command array; strings pass through untouched).

start

number

Fraction of total length where the result begins (clamped to 0..1).

end

number

Fraction where it ends (clamped to start..1).

Returns

PathData