Community-contributed drawing algorithms for ClawDraw agents.
| Algorithm | File | Description |
|---|---|---|
sierpinskiTriangle |
primitives/sierpinski-triangle.mjs |
Recursive Sierpinski triangle fractal |
voronoiNoise |
primitives/voronoi-noise.mjs |
Organic Voronoi cell noise with hand-drawn edges |
phyllotaxisSpiral |
primitives/phyllotaxis-spiral.mjs |
Sunflower-inspired golden angle spiral |
orbitalDynamics |
primitives/orbital-dynamics.mjs |
Gravitational orbit trails around attractors |
reactionDiffusion |
primitives/reaction-diffusion.mjs |
Turing-inspired contour patterns (spots, stripes, labyrinths) |
mandelbrot |
primitives/mandelbrot.mjs |
Mandelbrot set escape-time fractal with contour lines |
sphere3d |
primitives/sphere-3d.mjs |
Wireframe 3D sphere with latitude/longitude lines |
cube3d |
primitives/cube-3d.mjs |
Wireframe 3D cube with rotation and depth shading |
turingPatterns |
primitives/turing-patterns.mjs |
Multi-octave noise turbulence with contour extraction |
grayScott |
primitives/gray-scott.mjs |
Gray-Scott reaction-diffusion PDE simulation |
metaballs |
primitives/metaballs.mjs |
Implicit surface metaball field with contour lines |
domainWarping |
primitives/domain-warping.mjs |
Nested noise domain warping (Inigo Quilez technique) |
worleyNoise |
primitives/worley-noise.mjs |
Worley/cellular noise with F1, F2, F2-F1 distance modes |
slimeMold |
primitives/slime-mold.mjs |
Physarum slime mold agent simulation |
hopalongAttractor |
primitives/hopalong-attractor.mjs |
Martin hopalong strange attractor |
cliffordAttractor |
primitives/clifford-attractor.mjs |
Clifford strange attractor with trig functions |
doublePendulum |
primitives/double-pendulum.mjs |
Chaotic double pendulum with RK4 integration |
kaleidoscopicIfs |
primitives/kaleidoscopic-ifs.mjs |
Iterated function system with kaleidoscopic symmetry |
apollonianGasket |
primitives/apollonian-gasket.mjs |
Apollonian gasket via Descartes circle theorem |
voronoiCrackle |
primitives/voronoi-crackle.mjs |
Voronoi F2-F1 crackle texture with contours |
penroseTiling |
primitives/penrose-tiling.mjs |
Penrose P3 tiling via Robinson triangle subdivision |
hyperbolicTiling |
primitives/hyperbolic-tiling.mjs |
Hyperbolic tiling in Poincare disk model |
gielisSuperformula |
primitives/gielis-superformula.mjs |
Gielis superformula parametric curves |
lichenGrowth |
primitives/lichen-growth.mjs |
Cyclic cellular automaton lichen growth |
dla |
primitives/dla.mjs |
Diffusion-limited aggregation fractal growth |
schotter |
primitives/schotter.mjs |
Georg Nees "Schotter" — ordered grid dissolving into chaos |
langtonsAnt |
primitives/langtons-ant.mjs |
Langton's Ant cellular automaton with highway emergence |
waveFunctionCollapse |
primitives/wave-function-collapse.mjs |
Wave function collapse with pipe/maze tileset |
clockworkNebula |
primitives/clockwork-nebula.mjs |
A cosmic scene with starfield, spirograph gears, and nebula dust |
viridisVortex |
primitives/viridis-vortex.mjs |
Recursive fractal spiral with noise warp |
hexGrid |
primitives/hex-grid.mjs |
Honeycomb grid structure |
matrixRain |
primitives/matrix-rain.mjs |
Digital rain effect with glitch offsets |
sacredGeometry |
primitives/sacred-geometry.mjs |
Flower of Life and related patterns |
voronoiGrid |
primitives/voronoi-grid.mjs |
Voronoi-style cellular grid |
vineGrowth |
primitives/vine-growth.mjs |
Recursive branching vine tendrils with curl noise |
dragonCurve |
primitives/dragon-curve.mjs |
Heighway dragon fractal curve via L-system fold sequence |
gameOfLife |
primitives/game-of-life.mjs |
Conway's Game of Life cellular automaton |
juliaSet |
primitives/julia-set.mjs |
Julia set escape-time fractal with contour lines |
kochSnowflake |
primitives/koch-snowflake.mjs |
Koch snowflake fractal via recursive edge subdivision |
hypercube |
primitives/hypercube.mjs |
4D tesseract wireframe projected to 2D with rotation |
gear |
primitives/gear.mjs |
Mechanical cog wheel with trapezoidal teeth, hub, and spokes |
starburst |
primitives/starburst.mjs |
Radial sunburst with alternating triangular rays colored by angle |
Clone this repo and import any algorithm directly:
git clone https://github.com/kajukabla/ClawDrawAlgos.gitimport { sierpinskiTriangle } from './ClawDrawAlgos/primitives/sierpinski-triangle.mjs';
const strokes = sierpinskiTriangle(0, 0, 150, 4);
// Returns array of stroke objects ready for ClawDraw- Copy
_template.mjstoprimitives/your-algorithm.mjs - Implement your algorithm following the template pattern
- Export
METADATAand your named function - Test locally with
node -e "import('./primitives/your-algorithm.mjs').then(m => console.log(m.yourAlgorithm(0, 0)))" - Submit a pull request
Algorithms in this repo import helpers from ./helpers.mjs (same directory). If you copy an algorithm into ClawDraw's community/ directory, change the import to ../primitives/helpers.mjs.
All algorithms can import from primitives/helpers.mjs:
| Helper | Description |
|---|---|
clamp(v, min, max) |
Clamp a number to a range |
lerp(a, b, t) |
Linear interpolation |
hexToRgb(hex) |
Convert hex color to {r, g, b} |
rgbToHex(r, g, b) |
Convert RGB to hex string |
lerpColor(hex1, hex2, t) |
Interpolate between two hex colors |
hslToHex(h, s, l) |
Convert HSL to hex |
samplePalette(name, t) |
Sample a gradient palette at position t (0-1) |
randomPalette() |
Get a random palette (array of hex stops) |
randomColor() |
Get a random color from a random palette |
PALETTES |
Object with 5 scientific palettes: magma, plasma, viridis, turbo, inferno |
noise2d(x, y) |
2D Perlin noise (-1 to 1) |
makeStroke(points, color, brushSize, opacity, pressureStyle) |
Create a stroke object from {x, y} points |
splitIntoStrokes(points, color, brushSize, opacity, pressureStyle) |
Split long point arrays into multiple strokes |
clipLineToRect(p0, p1, minX, minY, maxX, maxY) |
Clip a line segment to a rectangle |
{
id: 'tool-...',
points: [{ x, y, pressure, timestamp }],
brush: { size, color, opacity },
createdAt: timestamp
}- Maximum 200 strokes per algorithm call
- Maximum 5000 points per stroke (use
splitIntoStrokesfor longer paths)
MIT



































