A fogged-up mirror with Claude Code: steam over your webcam, wipe it with a finger, drops run, fog returns (live demo)
Claude Code built a steamed-up mirror in WebGL2: wipe to see your webcam, thick strokes drip, fog returns in 6 s. Both prompts, the layers, a demo.
Everyone has drawn a heart on a steamed-up bathroom mirror. This page puts that in the browser: open it, and your laptop camera sits behind a layer of steam. Wipe with a finger or the mouse and that spot turns clear; write a little thicker and drops slowly run down; leave it alone and about 6 seconds later the fog creeps back in from the edges.
The whole page was written by a fresh Claude Code agent from our prompt: one index.html, plain WebGL2, no libraries. A second turn made the fog lighter and the drops bigger. We did not touch the code. Here you get the playable page, both prompts in full (swap the [ ] parts for yours), the three layers you see when you press L, whether the camera feed goes anywhere, and how to play with a photo if you have no camera. The person in the photos is AI-generated, and every image below is a real screenshot of that page.
01The result: a steamed-up mirror you can write on

There are only three things on screen: the sharp camera image underneath (flipped left-right, like a mirror), a blurry, grainy layer of fog on top, and the marks you wipe into it. "Change photo" sits at the bottom left and "Re-fog" at the bottom right; both buttons are semi-transparent so they never block the image. (The page UI is in Traditional Chinese: 換照片 = Change photo, 重新起霧 = Re-fog.)
- Try it: the fog mirror (with your camera) — Your browser asks to use the camera; click Allow. Saying no is fine, it switches to a sample photo
- Try it: no camera, straight to the photo — No camera prompt at all; you can still press Change photo to use your own
- Open the first link and allow the camera. On a computer, press and drag with the mouse; on a phone, draw with your finger.
- Slowly write one thick word and rest your finger on the last stroke: drops appear, run down a little and stop.
- Leave it for about 6 seconds and watch the fog grow back from the edges of the strokes.
- On a computer, press L on the keyboard to see the camera, fog and wipe mask side by side; press it again to return to the mirror.
02Does the camera feed get uploaded? The permission, explained
Hesitating at "Allow camera" is normal. We read through all of the code Claude Code wrote, and the answer is: the camera image is processed only inside your browser and is not sent anywhere.
- It asks for video only, no sound: the getUserMedia call requests video (front camera, ideally 1280×720) with audio: false, so the microphone is never used.
- Frames go straight to your screen: each camera frame is handed to WebGL, blurred, fogged and wiped on your own graphics chip, then drawn onto the page canvas.
- There is no upload anywhere in the code: no fetch, no XMLHttpRequest, no WebSocket, and it never saves the image as a picture. The page only loads its own font and sample photo from its own folder.
- Change photo works the same way: the photo you pick is read through a temporary local browser URL (createObjectURL), released right after, and never uploaded. Switching to a photo also turns the camera off.
- To stop, just close the tab.
Browsers only allow the camera on https:// or localhost, and only after you click Allow. If you say no, have no camera, or never answer, the sample photo is shown and the mirror still works; when you say no or there is no camera, a small line at the top says it switched to the photo.
03Prompt 1: a whole mirror in 8 points
- Make an empty folder, add an img/ folder inside it and put one landscape photo in it named photo.jpg (used when there is no camera).
- Open Claude Code in that folder.
- Paste the whole prompt below (swap the [ ] parts for yours) and press Enter.
- When it has written index.html, run npx serve (or any local server) in the folder, open the localhost address it prints and allow the camera.
Build me a "fogged-up mirror" web page as a single file, index.html (HTML, CSS and JS together). When the page opens, the whole screen is a [bathroom mirror right after a hot shower]: 1. Behind the mirror: the laptop's camera feed (ask for camera permission, flip it left-right like a mirror), clear and sharp, filling the whole window. If there is no camera or the user says no, use a photo instead (img/photo.jpg by default; a "Change photo" button also lets them upload their own). 2. On the mirror: a layer of steam. Heavily blur the image underneath, brighten it, give it a [cold white] fog tint, and add fine grain and uneven thickness, with denser fog in the four corners. It should look like a real steamed-up mirror, not plain frosted glass. 3. Dragging a finger or the mouse across it is like wiping the steam off with a fingertip: wiped areas show the clear image, with soft, slightly irregular stroke edges, thinner where the stroke is fast. It must work with a finger on a phone. 4. Water drops: where a stroke is thick, or the finger stays still for a while, a few drops slowly run down, leaving a thin clear trail, and stop after a while. 5. The fog grows back: about [6] seconds after an area was wiped, it slowly fogs up again (starting at the edges and creeping back to the middle), and the drip trails get covered too. 6. A small "Re-fog" button at the bottom right fogs the whole mirror again; a small "Change photo" button at the bottom left. 7. Press L to switch to a "layers" view: the screen splits into three panels labelled "Camera (clear)", "Fog (blur + grain)" and "Wipe mask", so anyone can see at a glance how it is stacked; press L again to go back to the mirror. 8. UI text in [English]. The buttons are subtle and semi-transparent and never block the image.

Claude Code wrote one index.html using the browser's built-in WebGL2, with no libraries and no outside URLs at all; it also cut the Chinese characters the UI needs out of Noto Sans TC into fonts/. If the browser has no WebGL2, the page simply says so.
It also did a few things the prompt did not ask for: stroke width follows speed (thickest when slow, down to about 40% when fast); stroke edges carry faint fingerprint-like streaks; and however fast or slow mouse events arrive, it joins each point to the last one, so strokes never break into dots.
04Press L to see how it works: camera, fog and mask stacked

This is the layers view from point 7 of the prompt. Left to right, the three panels are how the mirror is stacked from bottom to top:
- Camera (clear): the original camera image or photo, filling the window. The camera is flipped left-right; photos are not.
- Fog (blur + grain): the image shrunk to 1/6, blurred three times, then brightened, slightly desaturated and mixed toward a cold white. The fog thickness varies in large uneven patches, heavier in the corners and along the bottom, with fine grain and tiny condensation beads on top.
- Wipe mask: a black-and-white image where white means wiped. At half the screen resolution it stores two things: how clear each spot is, and how many seconds since it was last wiped.
- The final picture: where the mask is white you see the camera, where it is black you see fog, and the greys in between are the soft edges.

You can keep drawing in the layers view, in any of the three panels, and the strokes map back onto the same mirror. Press Re-fog and the mask slowly turns black again.
05The two details that sell it: drops and the fog growing back

The drops are point 4 of the prompt. This is how Claude Code did them:
- Only thick strokes drip: drops form along the lower edge only when you write slowly and the stroke is thick, and thicker means more drops. Quick thin swipes do not drip.
- Resting your finger drips too: hold still on one spot for more than 0.3 seconds and the wiped spot slowly widens, with one more drop every half second, up to 5.
- They run like real water: each drop waits 0.5 to 1.9 seconds, then runs down in stops and starts with a slight sideways wobble, and stops after 60 to 230 px. Its path is wiped too, leaving a thin clear trail.
- Each drop is drawn as a tiny lens: an upside-down image inside, a dark rim and a highlight.

The fog growing back is point 5. A wiped spot starts fogging over about 5.3 to 6.6 seconds later (slightly different everywhere, so it looks natural), and spots next to fog grow back faster, so the fog closes in from the edges of each stroke toward the middle instead of the whole word fading at once. Drip trails appear later than their stroke, so they are set to fog over a little sooner. Re-fog covers the whole mirror again in about 1.4 seconds.
06Prompt 2: lighter fog, bigger drops
In the first version the fog was so thick you could not see the person at all, and the drops were too small to notice on a phone. In the same conversation we followed up with:
Three tweaks: 1. Make the fog lighter (about [35%] lighter) so the hair and the person's outline faintly show through; keep the grain. 2. Make the drops and trails more visible: bigger drops and thicker trails running down, visible on a phone too. 3. Make the three panels of the layers view bigger, filling as much of the screen width as possible, with bigger labels, so they read at a glance.

- Fog: the cold-white tint is about 38% weaker and the brightening and blur are lighter, so hair and outline show through; the grain is unchanged.
- Drops: radius up from 3 to 5.4 px to 4.4 to 7.4 px, trails about 2.5 times wider, with a bright rim and a darker centre so they look wetter.
- Layers view: on a 1440×900 screen each panel grew from about 424×265 to 456×456, all three showing the same centre crop of the mirror, with labels at 24 px.
07No camera? Play with a photo
Photo mode is already in point 1 of the prompt: with no camera, a refused permission, or ?nocam=1 in the address, it uses img/photo.jpg as the image behind the mirror. The Change photo button at the bottom left lets you pick any photo on your phone or computer; once you pick one, the camera turns off and that photo is used (photos are not flipped).
There is no real person in our reel. The woman behind the mirror is three ChatGPT "laptop webcam" photos (waving, reaching a finger toward the lens, saying good night by lamplight), fed to the same page in photo mode. The demo's sample photo is the waving one.

Create an image. A landscape 16:10 laptop-webcam view (what the built-in camera of a laptop sees): a fictional [young woman with long dark hair], sitting in [her cosy bedroom at golden hour], looking straight into the camera [and waving at it with one open hand raised close to the lens, a soft happy smile]. [Warm late-afternoon sunlight from a window on the side, a white door and a pale wall behind her.] She is centred, head and shoulders filling the middle of the frame. Natural, slightly soft webcam look, real photo, not glossy. No phone, no text, no logos, no watermark.
- ChatGPT — We used it for the sample photos
08Make your own version
- Change the scene: swap "bathroom mirror right after a hot shower" at the top of prompt 1 for "a car window misted up on a rainy day" or "frosted glass on a winter morning", and set the fog tint to your colour (cold blue, warm yellow).
- Change the timing: fewer seconds before the fog grows back makes it harder to finish a word; more seconds suits longer sentences.
- Change the photo: skip the camera and swap img/photo.jpg for your artwork or product shot, for a small "wipe to reveal" interaction.
- Already built and only want a small change: in the same conversation say "Leave everything else as it is, just [make the fog pale blue]."
09Good to know
- The page was written by Claude Code and we did not change the code; we only swapped in an AI-generated sample photo and compressed it. Every run comes out a little different, so your fog texture, drop size and buttons may not match ours.
- The camera only works on https:// or localhost, and only after you click Allow. If you double-click index.html to open it, the photo may not load (it shows a message asking you to open it with a local server); open it with a local server such as npx serve instead.
- The layers view only opens with the L key; there is no button for it on the page, so you cannot see it on a phone. To get it on a phone, ask Claude Code to add a "Layers" button.
- It needs a browser with WebGL2. Current Chrome, Edge, Safari and Firefox all work; very old browsers show a "not supported" message.
- The person in the photos is AI-generated, and 小晴 is a made-up name. Ask first before you use someone else's photo.
- In the reel the words were written by sending mouse paths in stroke order from a script, with no hand on screen; the laptop, desk and wall are ChatGPT backgrounds, with the real page recording placed on the screen.
- The demo's Chinese font only holds the characters the UI uses. If you download the demo and change the button text, switch back to the full font.
- Also: a scratch-off art gallery website with Claude Code — Another "wipe to see what is underneath" interaction, with scroll and scratch feel
- Also: a hand-tracking website with Claude Code — Also uses the camera: wave and a portrait folds into paper sculpture