Build a Parallax Starfield Night Sky Hero Section on Canvas in One HTML File
A prompt that produces a single HTML hero section with a three-layer canvas starfield, pointer and tilt parallax, shooting stars, a density slider and a calm mode.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a senior front-end developer and motion designer. Build a landing page hero called Nightfall Observatory for a dark-sky stargazing retreat, with a full-bleed animated night sky drawn on a single canvas behind the headline.
The sky has three star layers (far, mid, near) plus two hill silhouettes and a small observatory dome. Each layer shifts by a different amount as the pointer moves, creating depth. When the device reports orientation, tilt drives the parallax instead.
Rules:
1. Controls: pointer or tilt for parallax, arrow keys to pan, click or press S to launch a shooting star, Space to pause.
2. Shooting stars appear every few seconds with a fading gradient tail and disappear behind the hills; stars twinkle gently with warm and cool tints.
3. A glassy control panel holds a star density slider (0.3x to 2x, rebuilds the field live), a Calm mode toggle and a Pause button, all with visible focus states.
4. Calm mode turns on automatically under prefers-reduced-motion: no automatic shooting stars, slower twinkle, softer parallax.
5. Palette: deep navy sky, soft lavender horizon, one amber accent; real headline and supporting copy; layout works from 360 to 1280px and the canvas is crisp on high-DPI screens.
6. No external files, fonts, storage or network calls.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Naming exact layers, inputs and the density range removes guesswork, so the model writes one coherent animation loop instead of loose effects.
- Tying calm mode to prefers-reduced-motion yields an accessible default without extra prompting.
- Banning external assets and storage keeps the file runnable offline and inside sandboxed previews.
Paste into ChatGPT, Claude or Gemini. Save the reply's code as nightfall.html and open it in a browser, or use the chat's preview/canvas panel. Tilt works on phones that expose device orientation.
Common edits
- Swap the theme: change the copy and palette to a desert campsite, an ocean pier or a planetarium launch page.
- Add a soft synthesized whoosh for each shooting star using Web Audio, with a mute toggle in the panel.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
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.
Build a Click-to-Launch Fireworks Celebration Animation in One HTML File
A prompt that produces a single HTML page where clicks, taps or keys launch fireworks with gravity, fading trails, soft synthesized pops and a mute toggle.
Build an Animated Gradient Glitch Title Hero Header in One HTML File
A ready-to-paste prompt for a website hero header with a shifting gradient headline, a subtle glitch flicker, three switchable color presets and a reduced-motion fallback.
Build an Interactive Particle Network Background With Mouse and Touch Controls
A single HTML file with a full-screen canvas particle network that links nearby dots, reacts to mouse and touch, and has density, color and low-power controls.
Build a Confetti and Fireworks Celebration Effect in a Single HTML File
A ready-to-paste prompt that builds a reusable canvas confetti and fireworks layer with color theme presets, burst size control, Web Audio pops and automatic particle cleanup.
Build a Gallery of 12 Pure-CSS Loading Spinners with Copyable Code
You get a single HTML page showing 12 live CSS-only loaders, each with its own isolated CSS, a copy button, and a reduced-motion fallback that pulses gently instead of spinning.