Files
David Luzar b03c3bb2c6 chore(packages/excalidraw): vendor roughjs as @excalidraw/sloppy (#12832)
* chore(packages/sloppy): vendor roughjs as @excalidraw/sloppy

- port roughjs 4.6.4 with hachure-fill, path-data-parser and points-on-path into packages/sloppy
- move points-on-curve and roughjs's Random into @excalidraw/math
- output is identical to roughjs 4.6.4 (tests/parity.test.ts)

* fix(packages/sloppy): don't change the caller's points in polygon pattern fills

The fillers rotate a polygon's points in place and back, which left float
drift in an element's points every time a sharp, pattern-filled line's
shape was regenerated.
2026-12-03 23:03:24 +01:00
..

@excalidraw/sloppy

Hand-drawn shape generation for Excalidraw: generates sketchy shapes as op sets (Drawable) and draws them to a canvas or SVG.

Ported from roughjs 4.6.4, together with its hachure-fill, path-data-parser and points-on-path dependencies (points-on-curve lives in @excalidraw/math). See LICENSE.

The output is kept identical to roughjs 4.6.4 for the same seed and options: every existing drawing's look depends on the exact sequence of random draws. tests/parity.test.ts compares the two.

Usage

import { rough } from "@excalidraw/sloppy";

const generator = rough.generator();
const drawable = generator.ellipse(50, 50, 100, 60, { seed: 1, roughness: 1 });

rough.canvas(canvas).draw(drawable);