Now let's generate the background image for the rainy night window scene.
Now let's build the core ambient window experience. First, the rain ambience audio hook:
Now the core canvas component with the fog, rain streaks, and writing/fading logic:
Now update App.tsx and add the supporting CSS (vignette, window frame, ken burns pan):
Now let's build the project to confirm everything compiles correctly.
Build succeeded. Let's quickly check the build script to make sure type-checking isn't silently skipped in a way that could cause runtime issues, and review the final component once more for correctness.
Let me clean up a small dead-code branch in the backspace logic for clarity:
Rebuilding to confirm the cleanup didn't break anything:
The build succeeds. Here's a summary of what I built:
"Window" — an ambient, generative art piece rather than a typical app:
- The scene: A blurred, slowly panning night cityscape (generated bokeh image) sits behind a pane of glass, dimmed with a vignette and dark overlay for mood.
- The fog: A canvas layer is filled with a cold, bluish condensation color with a scattered droplet texture. Every frame, a tiny bit of fog color is quietly re-painted over the whole pane — invisible moment to moment, but over ~10-15 seconds it fully re-fogs anything that was cleared.
- Writing: Typing anywhere draws each character (in a handwritten Caveat font) using a "destination-out" erase onto the fog layer, revealing the blurred lights behind it — exactly like finger-writing on a foggy window. A blinking cursor line shows where the next letter will land. Enter wraps lines, Backspace un-writes the last letter and re-fogs that spot immediately.
- Fading: Since the fog constantly regenerates, written words are never permanent — they gradually mist over and disappear on their own, exactly like real condensation.
- Rain: Dozens of raindrop streaks continuously trickle down the glass, each one clearing a thin, wobbling trail through the fog as it falls, adding constant ambient motion.
- Wiping: Click-and-drag (or touch) wipes a soft, smeared clearing across the glass, like a hand across the window.
- Sound: A toggle button generates an endless, filtered rain hiss with a slow wandering LFO purely via the Web Audio API (no audio files), starting only on user interaction per browser autoplay rules.
- UI: Minimal — a faint "Window" label, a soft instruction line that fades away once you start writing, and a subtle window frame/border for framing.
I updated index.html's title/meta and loaded the Caveat + Cormorant Garamond fonts for the handwritten and ambient serif look.
Files built: index.html, src/hooks/useRainAmbience.ts, src/components/RainyWindow.tsx, src/App.tsx, src/index.css