Build an Animated Heart Blood Flow Infographic in a Single HTML File
Get a self-contained HTML page where a canvas diagram traces oxygen-poor and oxygen-rich blood through the heart in eight labeled steps, with a speed slider.
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 science illustrator. Build "Heartline", an animated explainer infographic that shows how the human heart pumps blood, as a single self-contained HTML file. A canvas diagram shows the lungs at the top, the body at the bottom, and a front-view heart with four labeled chambers in between. Glowing particles trace one full circuit in eight numbered steps: body to right atrium, right ventricle, pulmonary artery, lungs, pulmonary veins, left atrium, left ventricle, aorta, and back to the body. Rules:
- Color oxygen-poor blood blue and oxygen-rich blood red. Blend blue to red in the lungs and red to blue in the body, and show a legend.
- A side panel lists the 8 steps, each with a title and one plain-language sentence. The active step highlights in sync with a tracer dot, and clicking a step jumps to it.
- Controls: Play/Pause, Previous, Next, a speed slider from 0.25x to 2x, and keyboard shortcuts (Space and the arrow keys). Tapping the diagram pauses it.
- The chamber that is pushing blood squeezes gently. With prefers-reduced-motion, skip the squeeze and start paused.
- Add a soft heartbeat thump synthesized with the Web Audio API. Create it on the first interaction and include a visible mute toggle.
- Use no external files, fonts or storage. The page must be responsive from 360 to 1280px wide with readable contrast.
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 every vessel and chamber in order gives the model an exact path to animate, so the loop is anatomically correct the first time.
- Fixed blue/red colors with blends at the lungs and body make the oxygen change obvious without extra text.
- Syncing a tracer dot to the step list ties the motion to the explanation, and the controls let learners slow down or step through.
Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as heartline.html and open it in any browser, or view it in the chat's preview or canvas panel.
Common edits
- Change STEP_SEC or the slider range to make the whole loop slower for younger students, or add a quiz mode that hides the step titles.
- Swap the palette for a dark theme, or relabel the steps in another language for a bilingual classroom.
Keep exploring
More like this
Build a Mitosis vs Meiosis Comparison Infographic in a Single HTML File
Get a ready-to-open infographic that lines up mitosis and meiosis phase by phase, with SVG cell diagrams and a toggle that highlights only the differences.
Build an Interactive Plant Cell Diagram with Clickable Organelles and a Quiz Mode
A ready-to-paste prompt that produces a single HTML file with a clickable SVG plant cell, plain-language function cards for 11 organelles and a label-free quiz mode.
Build a Classroom Grade Distribution Infographic with Histogram and Quartiles
A single HTML file that turns an inline array of class scores into a histogram with mean and median markers, a box plot, stat cards and a plain-language summary.
Build a Color-Coded Parts of Speech Grammar Cheat Sheet in One HTML File
A prompt that builds an interactive grammar cheat sheet where every word in the example sentences is colored by part of speech, and hovering or tapping a word explains why it fits that category.
Build a Course Syllabus Roadmap Infographic with Weekly Deadline Badges
A prompt that produces an interactive one-page syllabus roadmap with week cards, quiz, project and exam badges, grade weights and a clickable detail panel.
Build a Flip-Card Science Vocabulary Infographic in a Single HTML File
You get a ready-to-open HTML page with twelve cell-biology vocabulary cards that flip to show a definition, a real example and an emoji icon, plus shuffle, reveal-all and keyboard controls.