Free · Full build guide

Build the helmet reveal effect

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.

How it actually works

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.

Why canvas and not CSS 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.

Step 1 — Generate the two images

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.

Prompt 1 — the portrait (generate first)
Studio portrait of a young woman, front-facing, looking directly at the camera, neutral confident expression. Head and shoulders, perfectly centered and symmetrical. Dark hair tied back close to the head. Even soft studio lighting on the face, minimal shadows. Transparent background, no backdrop. Sharp focus, high detail skin texture, editorial photography, shot on 85mm lens. Horizontal 16:9 composition, head centered in frame.
Prompt 2 — the helmet (upload image 1 as reference)
A futuristic racing helmet, front-facing view, perfectly centered and symmetrical, positioned and scaled to fit exactly over the head in the reference image. Glossy black shell with electric cyan and white geometric racing graphics, dark reflective visor covering the entire face opening. The subject's hair is fully tucked inside the helmet — no hair visible outside the shell. Transparent background, no backdrop. Clean product photography, even studio lighting. Sharp focus, horizontal 16:9, helmet centered. Keep the exact same composition, head position and scale as the reference image.

The three things that go wrong

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.

Step 2 — Crop both images identically

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:

from PIL import Image g = Image.open('girl.png') h = Image.open('helmet.png') gb, hb = g.split()[3].getbbox(), h.split()[3].getbbox() # Union box — crop BOTH identically so alignment is preserved. box = (min(gb[0], hb[0]), min(gb[1], hb[1]), max(gb[2], hb[2]), max(gb[3], hb[3])) g.crop(box).save('public/girl-c.png') h.crop(box).save('public/helmet-c.png')

Also: use 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.

Step 3 — The build prompt

Paste this into Claude Code, Cursor, or any coding agent. It encodes every decision that took trial and error to find.

Build a full-screen hero section with a liquid cursor reveal effect. STACK - Next.js (App Router) + TypeScript + Tailwind - GSAP + Lenis for smooth scroll (GSAP is 100% free since v3.13, all plugins included) - No Three.js, no WebGL — a 2D canvas is enough ASSETS Two transparent PNGs in /public, already cropped to identical bounding boxes: - /girl-c.png — a portrait - /helmet-c.png — a helmet, aligned to sit over the head in the portrait THE EFFECT The portrait is a CSS background layer. The helmet is drawn to a canvas on top of it every frame. A blob following the cursor is ERASED from the helmet with `destination-out` compositing, so the face reads through the hole. Do NOT use CSS `mask-image`. Turning blobs into holes requires `mask-composite: subtract`, which silently no-ops in several engines. Do not use an SVG data-URI mask either — encoding and mask-mode both have to be exactly right or it fails with no error. Canvas `destination-out` is the reliable route. THE BLOB SHAPE — this is what makes it look liquid Trace a closed path of ~160 points around the cursor. For each point at angle a: 1. Modulate the radius with SIX octaves of sine at rising frequency and falling amplitude — cheap fractal noise: n = sin(a*2 + t*1.1) * 0.26 n += sin(a*3.7 - t*1.7) * 0.18 n += sin(a*6.1 + t*2.4) * 0.12 n += sin(a*11.3 - t*3.2) * 0.08 n += sin(a*19.7 + t*4.1) * 0.05 n += sin(a*31.1 - t*5.3) * 0.03 Two sine waves gives a smooth oval. Six octaves gives tendrils and pinches. The high-frequency terms run fastest, so the edge boils rather than drifts. 2. Shape it into a rounded rectangle with a superellipse, p = 3.4: sq = 1 / pow(pow(abs(cos(a)), p) + pow(abs(sin(a))/0.78, p), 1/p) p=2 is an ellipse; higher squares the corners while keeping the outline smooth. The /0.78 makes it wider than tall. 3. Final radius = RADIUS * sq * (1 + n), with RADIUS ≈ 118. Apply `filter = "blur(10px)"` on the erase pass so the two photographs bleed into each other instead of meeting on a hard line. Don't blur more than that or the fractal detail is smoothed away. Add 4 satellite droplets orbiting just outside the main blob, also erased. An edge that stays connected reads as a shape; detached blobs read as something spreading. CURSOR - `cursor: none` on the container, with a small 8px dot standing in for it - Lerp the pointer position at 0.13 per frame — following exactly reads as mechanical, a little lag gives the blob weight - Write position as CSS custom properties directly to the DOM. Never React state — a re-render per mousemove drops frames PARALLAX Shift the helmet ~16px horizontally and ~12px vertically toward the pointer, and the portrait at ~55% of that. The two planes disagreeing slightly is what stops the composite reading as one flat photo. Keep it small — more and the helmet visibly slides off the head. DRAWING Fit both layers with `contain`, not `cover`. The images are near-square and a desktop viewport is ~2:1; covering scales them until the width fits and throws the head off screen. LAYOUT - Near-black background (#08090c), full-bleed - Brand mark top-left, minimal nav top-right - One line of body copy bottom-left, a "MOVE TO REVEAL" hint bottom-right - Nothing over the centre of the frame — the subject owns it - Fluid type with clamp(); minimum 24px body at 1080 width BACKGROUND Behind everything, a second canvas: ~22 long contour lines drifting across the screen, each with its own wavelength, phase and direction, bending away from the pointer with exponential distance falloff. Plus 2–3 very soft radial colour washes at low alpha. Topographic and organic — never a grid. PERFORMANCE - Cap dpr at 2 - One requestAnimationFrame loop, no React state in it - Respect prefers-reduced-motion

The numbers worth tuning

Everything above is a starting point. These are the five values that actually change how it feels.

ValueDefaultWhat it does
RADIUS118Size of the reveal
p (superellipse)3.42 is an ellipse, higher is more rectangular
Noise amplitudes0.26 → 0.03Raise all six for a more violent edge
blur()10pxLower is sharper and more defined
Lerp factor0.13Lower means the blob lags further behind the cursor

If you want the real thing

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.