The liquid cursor reveal you saw in the video. Two AI-generated images, one canvas, about 150 lines of code. Every prompt is here, including the exact build prompt you can paste into Claude or Cursor.
Before the prompts, the mechanism — because if you understand this, you can rebuild it with any two images.
Two transparent PNGs are stacked: a portrait underneath, a helmet on top. The helmet is
drawn to a <canvas> every frame, and a blob is erased out of
it with destination-out compositing. Wherever the blob is, the helmet has no
pixels, so the face underneath shows through.
Nothing moves. Nothing slides apart. One image dissolves into the other.
mask-image
The obvious approach is a CSS radial-gradient mask. It doesn't work, and it fails
silently. Turning solid blobs into holes needs
mask-composite: subtract, and support for that is inconsistent enough that
you get no error and no mask — just an unmasked image and an hour of confusion.
SVG masks via data URI are worse: encoding, mask-mode, and
luminance-vs-alpha all have to agree, and any one being wrong disables the whole thing.
destination-out on canvas is universally supported and does exactly the
same job.
Use Gemini, or any image model that supports a reference image. The critical constraint: the two images must share the same canvas, same pose, same scale. If the head shifts between them, the reveal breaks.
Hair sticking out. If the portrait's hair is wider than the helmet, it shows around the edges permanently. Say "hair fully tucked inside the helmet" in prompt 2, and keep the hair tied back in prompt 1.
Baked-in backgrounds. Ask for transparent explicitly. Models often
render a grey studio backdrop into a .png anyway — check the alpha channel
before you build.
Mismatched framing. Always upload image 1 as a reference for image 2. Generating both from scratch will never align.
This is the step everyone skips, and it's why their version looks broken.
Image models pad output with transparent or letterboxed margins, and the padding is usually different for each image. If you crop each one to its own content, you shift them relative to each other and the helmet no longer sits on the head.
Crop both by the union of their bounding boxes instead:
contain, not cover
These images are near-square. A desktop viewport is closer to 2:1. Drawing them with
cover scales them until the width fits, which throws most of the
head off the top and bottom of the screen — you end up looking at a giant visor.
Fitting by height keeps the whole subject in frame and lets the background show at the sides. That's the composition award-winning sites use anyway.
Paste this into Claude Code, Cursor, or any coding agent. It encodes every decision that took trial and error to find.
Everything above is a starting point. These are the five values that actually change how it feels.
| Value | Default | What it does |
|---|---|---|
RADIUS | 118 | Size of the reveal |
p (superellipse) | 3.4 | 2 is an ellipse, higher is more rectangular |
| Noise amplitudes | 0.26 → 0.03 | Raise all six for a more violent edge |
blur() | 10px | Lower is sharper and more defined |
| Lerp factor | 0.13 | Lower means the blob lags further behind the cursor |
The award-winning sites doing this use a WebGL fragment shader — two images as textures, mixed by a simplex-noise field displaced by the pointer. That's how you get true liquid tearing rather than an approximation.
Codrops has the full tutorial if you want to go there. But on a phone screen, in a fifteen-second clip, the canvas version is close enough that nobody can tell — and it's an afternoon instead of a week.