Skip to content

Sketch Examples

The sketch examples below are rendered via npm run docs:examples and use transparent backgrounds with light strokes for dark docs themes.

Line

Line sketch

ts
sketchLine("line-1", [-40, -20], [40, 20]);

Arc

Arc sketch

ts
sketchArc("arc-1", [30, 0], [0, 30], [0, 0], "ccw");

Circle

Circle sketch

ts
sketchCircle("circle-1", [0, 0], 22);

Ellipse

Ellipse sketch

ts
sketchEllipse("ellipse-1", [0, 0], 26, 12, { rotation: exprLiteral(20, "deg") });

Rectangle (Center)

Center rectangle sketch

ts
sketchRectCenter("rect-center", [0, 0], 60, 32, { rotation: exprLiteral(10, "deg") });

Rectangle (Corner)

Corner rectangle sketch

ts
sketchRectCorner("rect-corner", [-25, -12], 60, 30, { rotation: exprLiteral(-8, "deg") });

Slot

Slot sketch

ts
sketchSlot("slot-1", [0, 0], 70, 16, { rotation: exprLiteral(12, "deg") });

Polygon

Polygon sketch

ts
sketchPolygon("poly-1", [0, 0], 24, 6);

Spline

Spline sketch

ts
sketchSpline("spline-1", [
  [-30, -10],
  [-10, 20],
  [10, 10],
  [30, -15],
]);

Point

Point sketch

ts
sketchPoint("point-1", [0, 0]);

Rectangle Array

Rectangle array sketch

ts
sketchArray(
  { count: [3, 2], spacing: [28, 18], origin: [-28, -9] },
  ({ index, offset }) => sketchRectCenter(`rect-${index}`, offset, 18, 10)
);