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.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a front-end developer and medical science illustrator. Build "Pulse Chambers", an animated cross-section of the human heart that shows how blood moves through it. Draw the heart in inline SVG with four labeled chambers, the vena cavae, pulmonary artery, pulmonary veins and aorta, plus four valves (tricuspid, mitral, pulmonary, aortic) that visibly open and close. Small arrow chevrons stream along the vessels and through the chambers: blue for oxygen-poor blood, red for oxygen-rich blood.
Rules:
1. Loop a cardiac cycle of atrial systole, ventricular systole and diastole. The atria and ventricles squeeze in turn, and a phase panel names the current phase with one plain-language sentence and a moving progress bar.
2. A heart rate slider from 40 to 180 bpm, with presets for asleep, resting, jogging and sprinting, changes the speed and updates beat length, litres pumped per minute and a short description of the rate.
3. Controls: Play/Pause and Next phase buttons, Space and arrow keys, and click, tap or Enter on a chamber to explain what it does.
4. Synthesize a soft lub-dub with the Web Audio API. Create the AudioContext on the first interaction, keep the volume low and show a visible mute toggle.
5. Use a dark navy page with red, blue and yellow accents and a two-column layout that stacks below 760px. With prefers-reduced-motion, start paused and shrink the squeeze.
6. No external files, libraries, 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
- Inline SVG with fixed coordinates keeps the anatomy crisp at any width, and particles follow hidden paths using getPointAtLength.
- One cycle value drives the chamber squeeze, valve angles, sounds and the phase text, so everything stays in sync.
- Exact colors, controls and accessibility rules leave the model nothing to guess, so the first output runs.
Paste into ChatGPT, Claude or Gemini. Save the code as pulse-chambers.html and open it in any browser, or run it in the chat's preview or canvas. It runs fully offline.
Common edits
- Change the theme to a light classroom style, or swap red and blue for a colorblind-safe orange and teal.
- Add a lungs panel where blue chevrons turn red as they pass the air sacs, or add an ECG trace synced to the phases.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
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 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.
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.
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 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 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.