The library itself, drawing live. Each drop displaces the ink already
floating rather than covering it, squeezing earlier colours into rings; then
a comb drags the whole surface at once. Every operation preserves area
exactly, which is what a film of pigment on water actually does.
Tap to drop pigment, drag to comb.
A dependency-free browser library that produces 17 traditional paper-marbling patterns with area-preserving geometric maps.
At a glance
Outcome: A browser library for paper marbling that needs nothing else
installed. It builds 17 traditional patterns, including battal, gel-git,
nonpareil, feather, hatip, suminagashi and Italian hair vein.
Status: Version 0.1 on GitHub, the second engine. All 17 patterns, nine
named rakes and the texture pass are in the repo. The demo on this page runs
an earlier copy of the engine with five patterns and no rake catalog.
Role: Solo: designed the model, the maps and the tests; reviewed
AI-assisted implementation.
Stack & libraries: Plain JavaScript modules, zero dependencies, no build
step, one canvas. The texture pass runs on the CPU over ImageData, without
WebGL.
Validation:node --test checks that drops, combs, curved rakes and
ripples keep every color’s area exact. Every figure comes from a fixed seed
with no clock, so it reproduces pixel for pixel.
Tests: Other tests check that a held press equals one large drop to 1e-6
and that every named rake keeps its teeth apart.
Limitations: No fluid solver and no color mixing, because pigment
displaces rather than blends. The stylus is the one tool that is slightly
lossy. italianVein takes about 2.4 s on a full sheet; the other patterns
take 50 to 600 ms.
Marbled paper is made by floating ink on a thickened bath and combing it. CabinFever does this on a web page. You tap or hold to drop ink and drag to comb. One <script type="module"> tag puts a marbling tray on a page.
Ink on a marbling bath does not cover other ink. It pushes it aside, because the film it floats on cannot be squeezed. So every tool in CabinFever is a math rule that moves every point on the tray while keeping each color’s area the same.
Battal uses only drops. Later ink displaces earlier ink into nested rings because the floating film cannot compress.
A drop moves each point by C + (P−C)·√(1 + r²/‖P−C‖²), which keeps area exactly. A comb tooth slides points sideways by an amount that depends only on their distance from the tooth. That also keeps area.
Four tools comb one ground in one direction. Each rake sets tooth spacing, sharpness and shape: straight, wandering or curved.
Color edges are stored as outlines, not pixels, so a strand pulled hair-thin stays a sharp line. A texture pass then adds paper grain and a darker rim along each edge.
Flat exact shapes look like vector art rather than marbled paper. A per-pixel pass adds pigment grain and darker rims along each edge.
Hatip, a traditional flower pattern, is built this way. Colors dropped one inside another squeeze into rings. A needle is then pulled outward through the rings and back in between them. No code draws a petal: the petals are what that pull does to rings inside rings.
Twelve more traditional patterns combine a ground with named tool passes. Hatip forms petals by pulling nested circles outward.
Each pattern runs in the order a marbler works. stone is only drops. gelGit works a needle down and up across the tray. nonpareil adds a fine comb, and feather a wide comb at right angles. Every drop is seeded, so one script and seed make the same pixels on any machine.
Each traditional pattern adds one tool pass to the previous result: battal, gel-git, nonpareil and feather. The code follows the physical process.
The library is on GitHub with all 17 patterns, nine named rakes, a small example and a full playground. The demo at the top of this page still runs an earlier copy with five patterns. Next is moving the demo and the clip onto the current library.
Published version 0.1 on GitHub: 17 traditional patterns, a catalog of named rakes and the texture pass, with no dependencies.
WHAT IT MAKES
A feather sheet built pass by pass with the library: drops, 14 gel-git passes, a fine comb, a wide comb, then the texture pass. Each tool pass is split into small exact steps of the same map.