Skip to content

No.203 · Backgrounds

Condensation

A misted window over blurred lights: drops gather, run down the glass and clear a trail that slowly fogs over, and your pointer wipes a streak you can see through.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

Written for the variant you picked above: City at night

Paint a window in Canvas 2D. Behind it, a scene of out-of-focus lights: a three-stop gradient and soft radial bokeh discs, denser and larger toward the street. Render that scene twice from one base canvas: a lightly blurred 'clear glass' copy and a heavily blurred 'fogged glass' copy with a pale haze and thousands of tiny condensation beads. Blur by drawing small and scaling back up, so it works without canvas filters. A mask canvas records where the glass is clear. Each frame: draw the fogged copy, then the clear copy through the mask (destination-in), then the drops. The mask fades a little every frame (destination-out), so cleared glass mists over again in about nine seconds. Drops appear at random, sit still and gather moisture; once heavy enough they let go and run down with acceleration and a slight sideways wobble, clearing a trail behind them, leaving tiny droplets in it and swallowing the still drops they pass (combining radii). Each drop is a lens: clipped to an ellipse, it shows a wider patch of the clear scene flipped upside down, with a dark rim and a small highlight. Moving the pointer (or dragging on touch) wipes a soft 24px streak. Cap DPR at 1.5, pause offscreen; reduced motion shows a still pane that can still be wiped. Selected variant — City at night (night): scene="night": a city at night behind the glass — sky gradient #0a0e1d → #1a1530 → #2a1a2a, bokeh lights in amber, coral, warm white and teal (#ffb45c, #ff6a4d, #fff0d2, #5fc8d6, #ffd27a, #ff8f6b) with a city skyline, haze rgba(190,200,222,.16), beads at 22% white. Overlay type in cream. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Move the pointer over the glass to wipe it clear; on touch, drag. Cleared glass mists over again. Motion: Drops run with gravity and wobble; trails and wipes re-mist over about 9s. Everything runs on one requestAnimationFrame loop paused offscreen. Accessibility: Decorative canvas (aria-hidden); anything placed on it stays real text. Reduced motion stops the rain and the re-misting; wiping still works because it only moves when you do. Responsive behavior: Regenerates the scene and drops for its size on resize; drop and light counts scale with area. Touch: Drag a finger across the glass to wipe it; vertical page scrolling still works. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Move the pointer over the glass to wipe it clear; on touch, drag. Cleared glass mists over again.
Motion
Drops run with gravity and wobble; trails and wipes re-mist over about 9s. Everything runs on one requestAnimationFrame loop paused offscreen.
Accessibility
Decorative canvas (aria-hidden); anything placed on it stays real text. Reduced motion stops the rain and the re-misting; wiping still works because it only moves when you do.
Responsive
Regenerates the scene and drops for its size on resize; drop and light counts scale with area.
On touch
Drag a finger across the glass to wipe it; vertical page scrolling still works.