
The elastic button
Buttons, Hover, Text
The live heart rate card of a running app, a chart that writes itself: the ECG trace is born from a glowing head running in from the left and leaving a fading tail, the beats per minute roll on the beat, like on a sports watch, and the drawn heart beats in time, lub and dub. When the pace rises the trace moves from Easy to Cardio to Peak and changes colour; hovering the trace, a thin hairline tells you the heart rate a few seconds ago.
A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.
<!doctype html>
<!--
"Live heart rate chart" from Animorio · https://animorio.com
License: free on your own sites and your clients’ sites, paid work included.
Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The live heart rate chart with the ECG trace writing itself</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the live heart rate card of a running app: the ECG trace is written from the left by a glowing head with
a fading tail, the bpm rolls on every beat, the drawn heart beats in time, and when the pace rises the
trace moves into the next zone and changes colour; over the trace a hairline reads back the past -->
<section class="card" data-card aria-label="Live heart rate, Halyard">
<header class="head">
<span class="mark" aria-hidden="true">
<svg viewBox="0 0 20 20"><path d="M3.5 13.2c2.4-.2 3.6-1.7 4.6-3.6 1-1.9 1.9-3.9 4.4-4.4M6.6 15.6c3.1 0 5-1.4 6.3-3.6.9-1.6 1.8-3.1 3.6-3.6"></path></svg>
</span>
<span class="who">
<span class="who__name">Tempo run</span>
<span class="who__sub">Halyard · <span data-clock>24:18</span></span>
</span>
<span class="zone-tag" data-zone-tag><span>Easy</span></span>
</header>
<div class="readout">
<span class="heart" data-heart aria-hidden="true">
<svg viewBox="0 0 24 24">
<defs>
<linearGradient id="carne" x1="0.2" y1="0" x2="0.8" y2="1">
<stop class="s1" offset="0"></stop>
<stop class="s2" offset="1"></stop>
</linearGradient>
</defs>
<path class="heart__body" d="M12 20.4c-.28 0-.55-.1-.76-.29C6.5 15.9 3.1 12.9 3.1 9.05 3.1 6.4 5.18 4.3 7.76 4.3c1.62 0 3.08.82 4.24 2.24C13.16 5.12 14.62 4.3 16.24 4.3c2.58 0 4.66 2.1 4.66 4.75 0 3.85-3.4 6.85-8.14 11.06-.21.19-.48.29-.76.29Z"></path>
<path class="heart__shine" d="M6.3 7.2c.5-.9 1.4-1.4 2.3-1.3"></path>
<path class="heart__shine heart__shine--2" d="M5.6 9.6c0 .5.1 1 .3 1.4"></path>
</svg>
</span>
<span class="bpm">
<span class="bpm__num" data-bpm aria-live="off"><span>112</span></span>
<span class="bpm__unit">bpm</span>
</span>
<span class="side">
<span class="side__label">Zone</span>
<span class="side__zone" data-zone-name><span>Easy</span></span>
</span>
</div>
<div class="trace" data-trace>
<canvas data-canvas aria-label="Heart rate trace" role="img"></canvas>
<span class="probe" data-probe aria-hidden="true">
<span class="probe__line"></span>
<span class="probe__tag" data-probe-tag>142 bpm</span>
</span>
</div>
<div class="zones" data-zones aria-hidden="true">
<span class="zones__seg" data-seg="0" style="--w:40"><i></i><b>Easy</b></span>
<span class="zones__seg" data-seg="1" style="--w:30"><i></i><b>Cardio</b></span>
<span class="zones__seg" data-seg="2" style="--w:30"><i></i><b>Peak</b></span>
<span class="zones__marker" data-marker></span>
</div>
<dl class="stats">
<div><dt>Avg</dt><dd data-avg>112</dd></div>
<div><dt>Max</dt><dd data-max>112</dd></div>
<div><dt>In zone</dt><dd data-inzone>0:00</dd></div>
</dl>
</section>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.
35 values to change
With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:
Take “Live heart rate chart” from Animorio and fit it into my siteEvery beat is the sum of five bells (Gaussians): the P wave, the Q dipping down, the R spike, the S, the wide T wave. When the heart beats fast the waves move closer together, like on a real ECG, instead of overlapping.
The head moves one pixel at a time on gsap.ticker and stores, for each column, the value, the zone, the beats and the moment. The canvas redraws from oldest to newest in four-pixel pieces, each with its own opacity: so the tail fades and the colours stay the ones they were written in.
The heart’s beat and the number start when the trace reaches the R spike, not at the start of the beat: you see it beat exactly when the line shoots up. The number changes at most once every nine tenths of a second, or at 170 beats it would never stop rolling.
Below 130 Easy, below 160 Cardio, above it Peak: at every beat the zone is worked out again, and only when it changes do the words, the card’s colour and the lit segment change.
The hairline over the trace takes the column under the pointer and its age, the distance from the head divided by the speed: that is how it knows the beats and how many seconds ago.
| Name | File | Default | What it changes |
|---|---|---|---|
SWEEP | script.js | 3.6 | How many seconds the head takes to cross the trace. |
REST | script.js | 112 | The beats per minute at the start and the end of the workout. |
PEAK | script.js | 168 | The beats per minute at the hardest sprint. |
LOOP | script.js | 18 | How long the workout loop lasts, in seconds. |
GLOW | script.js | 1 | How much the writing head glows. |
TAIL | script.js | 0.85 | How much the tail of the trace fades. |
In the app of a sports watch, a gym or an online coach, on the workout-in-progress screen; with other data, for any live signal with thresholds: a home’s energy use, a server’s traffic, breathing in a meditation app.
The same card at the width of the screen, with a shorter trace on short screens; a finger on the trace brings up the hairline reading the beats and doesn’t scroll the page.
No running head, beating heart or rolling numbers: the trace is written all at once and refreshes once a second, the texts change with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.5 KB; the libraries: GSAP 28 KB.
Tested on 30 October 2026
Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.