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

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

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

Example: Nightfall Observatory, a parallax night-sky hero for a stargazing retreat.

Move your pointer (or tilt a phone) and the three star layers, distant ridge and near hill with its little observatory slide at different speeds. Click anywhere in the sky or press S to launch a shooting star, use the arrow keys to pan, and Space to pause. Drag the Star density slider to thin or thicken the sky, and switch on Calm mode for slow twinkle with no automatic meteors.

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

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 in Animations & Effects