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

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

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

Example: Heartline, an animated canvas diagram of one full loop of blood through the heart.

Blue particles carry oxygen-poor blood from the body into the right side of the heart and up to the lungs. There they turn red and return through the left side to the aorta. The 8-step panel highlights in sync. Click any step, use Prev/Next or the arrow keys, drag the speed slider, or tap the diagram to pause.

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

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.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Infographics