Backgrounds · Component Template
Fluid Simulation
Luminous ink that the pointer pushes, stretches, and curls, simulated on the GPU at 60fps. One switch turns it into wet pigment on paper.
Live demo
Drag through the ink, click for a burst, or switch Glow to Ink. Leave it alone and it paints itself.
The Prompt
Build a full-viewport hero whose background is a real-time fluid simulation: luminous ink that the pointer pushes, stretches and curls, running on the GPU at 60 frames a second. It belongs to Murmur, a motion studio, and the whole point is that a visitor drags through it and cannot believe it is not a video. A switch turns the same simulation from glowing ink on black into wet pigment on paper. Match my project's existing stack, conventions, and design tokens. If there are none, output a single HTML file with inline CSS and JavaScript and zero dependencies. Raw WebGL only: no libraries, no video, no images.
LOOK
- Two surfaces. Glow: page #07070A, ink adds light. Ink: page #F3F1EA, ink absorbs light. The switch animates a registered custom property (@property --paper, a number from 0 to 1 over 700ms) that the page background mixes on, while the shader crossfades the same way.
- Type: ui-sans-serif, system-ui. The headline "Nothing here / holds still." is white, weight 620, clamp(50px, 10.6vw, 196px), line-height 0.86, letter-spacing -0.058em, and is blended with mix-blend-mode: difference so it inverts whatever ink passes under it. It is the only blended element.
- Everything small sits on glass, so it stays readable over any color: background color-mix(in oklab, var(--glass) 46%, transparent), backdrop-filter blur(22px) saturate(180%), a 1px inner edge, a 1px top highlight and a long soft shadow. Glass is #16161C with white text on Glow, white with #111 text on Ink (switched with :root:has(#ink:checked)).
- Three glass pieces: a 60px floating nav bar inset from the top edges (wordmark "Murmur", links Work, Studio, Journal with underlines that wipe in from the left and out to the right, a solid pill "Start a project"); a note card bottom right, clamp(264px, 31vw, 336px) wide ("Murmur is a motion studio in Rotterdam. We design identities, film titles and installations that move. This page is one of them, and it is not a video. Drag through it." and a pill "Watch the reel 2:14" with a round play mark); and a pill dock bottom center holding the controls.
- A film-grain overlay: one 128px noise tile generated on a canvas at load, mix-blend-mode overlay at 9%, jittered in 6 steps every 900ms.
THE SIMULATION
- Stable fluids on the GPU, WebGL2 with a WebGL1 fallback. Half-float render targets are required (EXT_color_buffer_float or the half-float extensions); if a test framebuffer is not complete, show three blurred radial gradients instead.
- Two grids. Velocity, pressure, divergence and curl at 144 cells on the short side (96 under 760px wide). Dye at up to 640 on the short side (420 on phones), linear filtered. The canvas itself renders at up to 1.5x device pixels.
- Each frame, with dt capped at 1/30: compute curl; add vorticity confinement (strength 24) to put back the small swirls; compute divergence with reflecting edges; fade pressure by 0.8, then 18 Jacobi iterations; subtract the pressure gradient; advect velocity by itself (dissipation 0.22 per second); advect dye by velocity (dissipation 0.95 on Glow, 0.34 on Ink).
- In the dye advection, rescale any texel whose largest channel exceeds 2.6 (2.4 on Ink) so color can never burn out to a flat field.
- A splat adds a Gaussian, exp(-d² / radius), to velocity and to dye at a point. Default radius 0.0022 (times the aspect ratio on wide screens). Momentum may be spread wider than color.
- Keep forces modest. A Gaussian push of more than a few hundred cells per second is a divergence source and inflates the dye like a balloon.
THE LOOK OF THE INK
- Treat dye as a surface: its luminance is height. Build a normal from the difference of the left/right and bottom/top neighbors (1.5 texels apart, times 5) and light it from the upper left: a diffuse term and a tight specular (power 30) that only appears where there is ink. This is what makes it read as liquid rather than smoke.
- Glow: color = dye x (0.5 + 0.75 diffuse) + specular + bloom, tone-mapped with 1 - exp(-1.9x), over the page color. Bloom is the dye thresholded into a quarter-size target and blurred twice with a separable 5-tap Gaussian (radius 1, then 2.4).
- Ink: the same numbers are pigment. Color = paper x exp(-1.25 x dye), shaded by the diffuse term, plus a little specular. Colors are stored as what they absorb: -ln(color) x 0.24. Where two inks overlap they mix like paint.
- Add a hash dither of plus or minus 0.5/255 so dark gradients never band.
MOTION
- First frame: five large soft splats are already on screen. Then jets fire from the bottom edge one after another (five, or three on portrait screens), each blowing upward for 0.65s, 0.12s apart.
- Pointer: once per frame, take the path since the last frame, cut it into at most five dabs and splat each. Force is 5200 x the movement, clamped so a jump across the screen pushes no harder than a quick flick. Dye is proportional to distance traveled, so slow and fast strokes lay down the same line. Hue advances along the palette with distance, so one stroke passes through several colors.
- Press: a ring of nine small splats pushes outward from the point.
- Idle for 3 seconds: two invisible emitters travel long looping paths and keep painting, so the page is never still.
- Load sequence: the headline's words rise out of their own clipping boxes 60ms apart on an expo-out curve; the nav, note and dock then sharpen from a 12px blur and settle on a spring, in that order.
- Springs are CSS: sample a damped spring into a linear() easing and use it for the dock's sliding thumb, swatch scale and button presses.
CONTROLS
- Four palettes as radio buttons drawn as conic-gradient discs: Ember (#FF2A1F, #FF7A00, #FF2E88, #8A2BFF), Tide (#00D5FF, #1F5BFF, #5DFFB8, #8A5BFF), Iris (#7A5CFF, #D14BFF, #FF5FC8, #35C8FF), Smoke (#FFFFFF, #AEBBE8, #FFE4C4, #8E99B8). Choosing one replays the opening in the new colors.
- A two-part switch, Glow and Ink, whose thumb slides on a spring using :has(). Switching wipes the dye and replays the opening on the new surface.
ACCESSIBILITY
- The canvas is aria-hidden. One h1; its words are wrapped for the animation but still read as one sentence.
- Controls are real radio inputs in labeled fieldsets, operable by keyboard, with visible focus rings.
- touch-action: pan-y on the canvas so the page still scrolls on phones.
- Pause the loop when the tab is hidden. Rebuild the grids on resize, copy the dye across, and delete the old textures and framebuffers.
- prefers-reduced-motion: place the five first-frame splats, run 70 simulation steps without showing them, draw one frame and stop. No loop, no pointer response, no grain animation.
NEVER
- No video, GIF or pre-rendered frames. No Three.js or other library.
- No rainbow hue cycling. Colors come from the four palettes only.
- No smoke on gray: the background is true black or paper.
- No text set directly on the fluid except the headline.
- No cursor trails, particles or sparkles on top of the fluid.
- CopyThe full prompt, one click.
- PasteInto Cursor, Claude Code, or any agent.
- CompareAgainst the live demo above.