Build an Animated Solar System with True Orbital Periods in One HTML File

Get a classroom-ready animated solar system with all eight planets on true relative orbital periods, a speed slider, pause, labels and click-to-open planet fact cards.

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 who also teaches astronomy. Build "Classroom Orrery", an animated solar system in one HTML file that a teacher can project in class. Draw the Sun and eight planets on a full-size canvas over a dark starfield. Each planet orbits on its true relative period in Earth days: Mercury 87.97, Venus 224.7, Earth 365.25, Mars 686.98, Jupiter 4332.6, Saturn 10759, Uranus 30687, Neptune 60190. Space the orbits evenly and add a note that timing is to scale but sizes and distances are not.
Rules:
1. Controls bar: Play/Pause, a logarithmic speed slider from 1 to 3,650 Earth days per second with a live readout of how long one Earth year takes, Labels and Orbits toggles, and Reset.
2. Clicking or tapping a planet, or a numbered planet chip, highlights it and opens a fact card: orbital period, distance, diameter, day length, known moons, orbits completed with a progress bar, and one memorable fact.
3. Keyboard: Space pauses, 1-8 and arrow keys pick planets, plus and minus change speed, L toggles labels, Esc closes the card.
4. Show an elapsed clock in Earth years and days.
5. Navy background, amber accent, one natural color per planet, readable labels, a ring on Saturn.
6. Scale the canvas for devicePixelRatio, resize from 360 to 1280px, and with prefers-reduced-motion start paused and drop the pulse. No external assets, storage or alerts.
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: Classroom Orrery, a projector-friendly animated solar system.

All eight planets circle the Sun using their real orbital periods. Drag the Speed slider to go from 1 day to 10 years per second. Watch Mercury lap Neptune hundreds of times. Click or tap any planet, or a numbered chip, to open its fact card with a live orbit counter. Press Space to pause, 1–8 or the arrow keys to switch planets, and L to hide labels.

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

Tips and common edits

Why this works

  • Giving exact orbital periods in days means the model computes angles from elapsed time, so the relative motion is accurate without any guesswork.
  • Spacing the orbits evenly keeps the inner planets clickable on a phone, and the visible scale note keeps the model honest for teaching.
  • Spelling out every control, key and fact-card field produces a finished classroom tool on the first try instead of a bare animation.

Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as orrery.html and open it in any browser, or run it in the chat's preview or canvas panel. Works offline, so it's safe to use on a classroom projector.

Common edits

  • Add the Moon around Earth or Pluto as a dwarf planet by giving it a period, color and fact card.
  • Switch the theme to a light printable palette, or add a soft Web Audio chime that plays each time Earth completes an orbit.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects