@mocanvas/mocanvas · function

getSvgPathFromStrokePoints

declare function getSvgPathFromStrokePoints(points: StrokePoint[], closed?: boolean): string

The centreline of a stroke as an SVG d, drawn with quadratic curves through the midpoints between samples.

Curving through midpoints rather than through the samples themselves is what makes a hand-drawn line look smooth: every sample becomes a control point, so the curve never has to turn a corner at one.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.