A little ink.
A hidden current.
Drag your finger and colour starts to curl. Here is what happens between that gesture and the next frame.
Ink Weather is a small fluid simulation running in your browser. Your gesture adds colour and movement; a repeating calculation carries both forward. The result keeps changing after you lift your finger.
The illustrations below are animated SVGs: clean, scalable diagrams of the ideas. The live ink uses a Canvas image, a JavaScript simulation and a WebGL smoothing pass.
Your finger leaves more than a mark.
The page holds an invisible grid. Each cell remembers a horizontal speed, a vertical speed, and three amounts of pigment: red, green and blue. Moving your finger adds a soft spot of colour and a directional push to nearby cells.
A broad brush touches more neighbours. More force adds a stronger push. The colour does not need a pre-drawn path: the grid will decide where it goes next.
Ask where the colour came from.
For each cell, the simulation traces backwards through the current. It samples the pigment at that earlier position and brings it into the cell. This is called advection. Repeating it makes a patch stretch into a ribbon.
The current also carries its own movement forward, so the direction can bend over time. Pigment fades a little on every step. Long trails reduce that fade; they do not slow the motion.
A closer look at the calculation
Between grid points, the solver blends four neighbouring samples. This is bilinear interpolation. It uses that lookup when moving velocity and pigment, rather than rounding to the nearest cell. The fade is exponential: pigment × exp(−timeStep × fadeRate).
Give the current something to turn around.
Neighbouring cells rarely move at exactly the same speed. Their differences create local rotation. The swirl control reinforces that rotation, helping the ink fold back around itself.
A pressure calculation then adjusts the speeds to reduce unwanted squeezing and spreading in the flow. These two operations have different jobs: swirl keeps the curls lively; pressure helps the motion behave like a fluid.
The ambient flow adds small, moving dabs when you are not painting. Turn it off to watch only the marks you made. “Release pigment” adds eight dabs around a ring, with a push around the circle.
Small calculations. Smooth edges.
Computing fluid at every screen pixel would be expensive. This version uses a grid with a longest side of roughly 256 cells, then turns its pigment values into an image. The visible canvas is sized for the display, with pixel density capped at 2×.
Simply enlarging a small image can expose its grid as little steps. The WebGL pass now uses bicubic interpolation: it samples a 4-by-4 neighbourhood to reconstruct colour between cells. That smooths the enlargement; it does not invent extra fluid detail.
The close-up shows a crop of this same rendered image. It is not a second simulation. Paint in either view, or change a control below the hero, and you are changing the same underlying ink.
What runs where?
JavaScript updates the fluid in typed arrays: move velocity, reinforce rotation, solve pressure with 14 iterations, correct velocity, then move and fade pigment. Canvas receives the colour image. WebGL smooths it for display; if WebGL is unavailable, Canvas uses its high-quality image scaling. The controls change shared settings read by this loop.
The SVGs in this post are explanatory sketches, not outputs from that solver. JavaScript moves their markers and groups. Each diagram can be paused, and reduced-motion preferences start them still.
Now try a slow stroke with low force. Then turn up the swirl and release another bloom. You know which part of the little world you are changing.
Go back and make some weather →