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
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
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 like this
Build an Animated Beating Heart Diagram With Blood Flow in One HTML File
A ready-to-paste prompt that builds an animated heart cross-section with color-coded blood flow, opening and closing valves, a heart rate slider and a soft synthesized lub-dub.
Build an Animated Water Cycle Diagram for a Science Lesson in HTML
A single HTML page with an animated SVG water cycle that labels evaporation, condensation, precipitation and collection, with step-through buttons and narration notes for teachers.
Build a Beat-Synced Kinetic Typography Quote Animation in One HTML File
A prompt that produces Beatline, a single HTML page animating a short quote word by word on a tempo grid, with varied entrances, replay and a clean recording mode.
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 a Gallery of Ten Looping Pure-CSS Loading Spinners in One HTML File
You get a single HTML page showing ten original pure-CSS loading animations in a tidy grid, each with a reveal-and-copy code snippet.
Build a Self-Drawing SVG Lighthouse Line Animation in One HTML File
You get a single HTML page where a hand-built SVG lighthouse draws itself stroke by stroke with staggered timing, then fades in its colors, with replay and speed controls.