Build an Animated Dawn-to-Night Landscape Scene in a Single HTML File

You get one HTML file that draws a canvas valley village whose sky, sun, moon, stars, clouds and window lights all follow a single time-of-day scrubber with autoplay.

The prompt

Prompt
Act as a senior front-end developer and illustrator who builds polished canvas scenes. Build "Lanternvale", a single-page animated landscape of a small valley village that cycles smoothly from dawn through noon, dusk and night. One time-of-day value from 0 to 24 hours drives everything, controlled by a range scrubber and an autoplay loop.

Rules:
1. Interpolate a three-stop sky gradient across at least 10 keyframes (deep night, pre-dawn, sunrise, morning, noon, golden hour, dusk) with smoothstep easing, so there are no visible jumps.
2. Move the sun and moon on opposite elliptical arcs that set behind four layered mountain ridges. Tint ridges, clouds and houses from night to day colors, and blend them toward the horizon color for haze.
3. Fade in twinkling stars as the sun drops. Light each house window at its own random threshold after dusk, and switch some off between 1 and 5 a.m.
4. Controls: Play/Pause button, a speed button (1x, 2x, 4x, where 1x is one day per minute), and jump buttons for Dawn, Noon, Dusk and Midnight. Space plays or pauses, arrow keys move 15 minutes (Shift moves an hour), and clicking the scene toggles play. Show the clock and phase name over the scene.
5. Respect prefers-reduced-motion: start paused, and turn off twinkle and cloud drift.
6. Make the canvas scale with devicePixelRatio and fit 360–1280px wide. Use no external assets, a dark control panel and readable contrast.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Lanternvale, a valley village that lives through a full day.

The scene autoplays one day per minute. Drag the Time of day scrubber to move to any hour, or use the Dawn, Noon, Dusk and Midnight buttons to jump there.

Keys: Space plays or pauses. The arrow keys move 15 minutes, and Shift + arrow moves an hour.

Try parking at 18:40 to see the sunset glow, then step toward 21:00 and watch the windows light up one by one.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • One hour value drives every layer: sky, sun, moon, stars and windows, so the scrubber and autoplay can never drift out of sync.
  • Smoothstep keyframe blending and haze toward the horizon color give smooth, painterly transitions with no external assets.
  • Reduced-motion users start paused with still stars, but the scrubber and jump buttons still let them see the whole cycle.

Paste the prompt into ChatGPT, Claude or Gemini. Save the code as lanternvale.html and open it in any browser, or run it in the chat's preview or canvas panel.

Common edits

  • Change the theme: swap the ridge and house colors for a snowy alpine town or a desert mesa, and rename the scene.
  • Add sound: a soft Web Audio cricket chirp at night and birdsong tones at dawn, started on first click and with a mute toggle.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects