@mocanvas/mocanvas · function
declare function traceTaperedStroke(ctx: CanvasRenderingContext2D, points: readonly {
x: number;
y: number;
}[], width: number, taper: boolean): voidTrace a scribble as a *tapered* ribbon rather than a stroked line.
A laser trail whose tail thins out cannot be drawn by stroking a polyline — a stroke has one width for its whole length. So the outline is walked: down one side offset by the half-width at each point, back along the other. The half-width is scaled by the point's position along the stroke, which is what produces the taper.
SEMANTICS-ASSUMED: the taper profile. The docs say a scribble may taper but
not how; a linear ramp over the first fifth of the stroke reads as a trail
with a point on it at every speed, and degenerates to a constant width when
taper is false.
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.