addCurve(path, {c1: {x, y}, c2: {x, y}, to: {x, y}})
Add a Bèzier curve command to a path.
close(path)
Add a close command to a path.
parse(path)
⚠️ this function cannot run on the UI thread. It must be executed on the JS thread
Parse an SVG path into a sequence of Bèzier curves. The SVG is normalized to have absolute values and to be approximated to a sequence of Bèzier curves.
serialize(path)
Serialize a path into an SVG path string.
interpolatePath()
Interpolate between paths.
constprogress=useSharedValue(0);// ⚠️ parse() cannot be executed on the UI threadconstp1=parse("M150,0 C150,0 0,75 200,75 C75,200 200,225 200,225 C225,200 200,150 0,150 ");constp2=parse("M150,0 C150,0 0,75 200,75 C75,200 200,225 200,225 C225,200 200,150 0,150 ");constanimatedProps=useAnimatedProps(() => {constd=interpolatePath(progress.value, [0,1], [p1, p2]);return { d };});return <PathanimatedProps={animatedProps} />;
mixPath()
Interpolate two paths with an animation value that goes from 0 to 1.
constprogress=useSharedValue(0);// ⚠️ parse() cannot be executed on the UI threadconstp1=parse("M150,0 C150,0 0,75 200,75 C75,200 200,225 200,225 C225,200 200,150 0,150 ");constp2=parse("M150,0 C150,0 0,75 200,75 C75,200 200,225 200,225 C225,200 200,150 0,150 ");constanimatedProps=useAnimatedProps(() => {constd=mixPath(progress.value, p1, p2);return { d };});return <PathanimatedProps={animatedProps} />;
getYForX
Return the y value of a path given its x coordinate