@mocanvas/mocanvas · function

getStrokePoints

declare function getStrokePoints(rawInputPoints: VecLike[], options?: StrokeOptions): StrokePoint[]

Resample and smooth raw input into the points the outline is built from.

Two things happen here. Streamlining pulls each sample towards the previous one, which removes the jitter a trackpad or a shaky hand puts into the stream. Then each point is given a radius from its pressure — real pressure from a pen, or pressure simulated from how fast the pointer was moving, on the observation that a fast stroke is a light 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.