MotionScript

@motion-script/core


@motion-script/core / parsePathString

Function: parsePathString()

parsePathString(d): PathCommand[]

Defined in: attributes/shape/path/parse.ts:12

Parse an SVG path d string into a PathCommand array.

Tokenizes on command letters and numbers (supporting scientific notation), then consumes the fixed argument count for each command. Implicit repeated commands — e.g. L 1 1 2 2 meaning two line-tos, or extra coordinate pairs after an M meaning implicit line-tos per the SVG spec — are handled by looping while numeric tokens remain before the next command letter.

Parameters

d

string

Returns

PathCommand[]