Skip to content
animorio
IT
Back to the library

Blood oxygen chart

SVG, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.9 KBGSAP 28 KBFreeDownload the zip

The blood oxygen card of a made-up trail running app, Summitry, white on warm paper like a Dribbble shot: the blue saturation line draws itself in SVG over the grey profile of the climb, and the two tell the same story, because as the ridge rises the oxygen sinks, two minutes late, and comes back on the way down. The cursor rides the tip of the pen and then reads the run on a spring: the value in the corner rolls digit by digit, the dark pill over the point says the height and the time and leans a little as it runs, and at the top of the climb the lowest reading settles in under its ring.

The code

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>
<!--
  "Blood oxygen 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 blood oxygen chart of a mountain run</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" data-stage>
    <!-- the blood oxygen card of a trail running app. The SpO2 line draws itself over the shape of the climb, the
         cursor rides the tip of the pen and then reads the run: the value in the corner rolls digit by digit, the
         pill above the cursor says the height and the time, and at the summit the lowest reading settles in -->
    <section class="card" data-card aria-label="Summitry blood oxygen">
      <span class="card__shine" data-shine aria-hidden="true"></span>
      <header class="card__head">
        <div class="card__title">
          <span class="card__brand">
            <svg class="card__mark" viewBox="0 0 20 20" aria-hidden="true">
              <path d="M2.5 15.5 8 7.2l2.6 3.6L13 8l4.5 7.5"></path>
              <path d="M6.6 9.3 8 10.4l1.2-.9"></path>
            </svg>
            <span>Summitry</span>
          </span>
          <h1 class="card__name">Blood oxygen</h1>
          <p class="card__run">Morning ridge run, 14.2 km</p>
        </div>
        <div class="card__now">
          <p class="card__value" aria-hidden="true"><span class="odo" data-odo></span><span class="card__pct">%</span></p>
          <p class="card__label">SpO<sub>2</sub> <span data-clock>7:02</span></p>
        </div>
      </header>

      <div class="chart" data-chart>
        <svg class="chart__svg" data-svg aria-hidden="true">
          <defs>
            <linearGradient id="ox-fill" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="var(--accent)" stop-opacity="0.2"></stop>
              <stop offset="0.7" stop-color="var(--accent)" stop-opacity="0.04"></stop>
              <stop offset="1" stop-color="var(--accent)" stop-opacity="0"></stop>
            </linearGradient>
            <linearGradient id="ox-hill" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="var(--hill)" stop-opacity="1"></stop>
              <stop offset="1" stop-color="var(--hill)" stop-opacity="0.25"></stop>
            </linearGradient>
            <pattern id="ox-hatch" width="5" height="5" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
              <line x1="0" y1="0" x2="0" y2="5" stroke="var(--accent)" stroke-opacity="0.16" stroke-width="1"></line>
            </pattern>
            <clipPath id="ox-reveal"><rect data-reveal x="0" y="0" width="0" height="0"></rect></clipPath>
          </defs>
          <g data-grid></g>
          <rect class="chart__low" data-low></rect>
          <g clip-path="url(#ox-reveal)">
            <path class="chart__hill" data-hill></path>
            <path class="chart__ridge" data-ridge></path>
            <path class="chart__fill" data-fill></path>
          </g>
          <text class="chart__peak" data-peak>Summit 2,610 m</text>
          <path class="chart__line" data-line></path>
          <g class="chart__min" data-min>
            <circle class="chart__min-ring" data-min-ring r="5.5"></circle>
          </g>
          <line class="chart__hair" data-hair></line>
          <g data-dot-pos>
            <g class="chart__dot" data-dot>
              <circle class="chart__dot-halo" r="9"></circle>
              <circle class="chart__dot-core" r="4.5"></circle>
            </g>
          </g>
        </svg>
        <div class="tip" data-tip><span class="tip__face" data-tip-face><span data-tip-alt>1,420 m</span><span class="tip__rule"></span><span data-tip-time>7:02</span></span></div>
        <div class="lowest" data-lowest><span class="lowest__face">Lowest <b data-lowest-val>89%</b></span></div>
        <div class="axis" data-axis></div>
      </div>

      <footer class="stats">
        <div class="stat"><span class="stat__k">Average</span><span class="stat__v" data-avg>95%</span></div>
        <div class="stat" data-stat-low><span class="stat__k">Lowest</span><span class="stat__v" data-min-val>89%</span></div>
        <div class="stat"><span class="stat__k">Below 92%</span><span class="stat__v" data-below>7 min</span></div>
      </footer>
    </section>
    <p class="sr" aria-live="polite" data-live></p>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

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.

34 values to change

Or ask your AI assistant for it

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 “Blood oxygen chart” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a cream paper page with a fine grain a white card with round corners rises, with a soft layered shadow. At the top the Summitry mark with its small ridge, the title ‘Blood oxygen’ and ‘Morning ridge run, 14.2 km’; on the right the big value in percent and under it ‘SpO2’ with the time. In the chart, over four thin lines (88, 92, 96, 100, with 92 dashed in blue and a hatched band under it), a blue point with a white rim starts from the left and draws the saturation line: behind it the grey profile of the climb rises, with a dotted edge, and under the line a blue gradient fades downwards; the number at the top rolls as the pen goes down. When the line passes the lowest point a ring opens with a small snap and the label ‘Lowest 89%’ settles in under it, and on the top of the profile ‘Summit 2,610 m’ appears. Then the dashed line of the cursor arrives with a dark pill showing the height and the time: the cursor goes back to the start, down to the lowest point (the ring widens and ‘Lowest’ at the bottom turns blue), on towards the descent and to the end, always on a spring that passes the mark by a little, with the pill following slightly late and leaning. At the end the line rubs itself out from the left and the loop starts again. With the pointer the cursor is yours; pressing, the point squeezes and comes back on an elastic.

How it works

A believable run

Fifty-nine readings, one a minute from 7:02: the height climbs from 1,420 to 2,610 metres on a soft curve and comes down; the oxygen is 98 minus a share of the climb raised to 1.3, read two minutes late, plus three small sines for the breathing. Average, lowest and minutes under 92 come from the same data.

Two soft curves

The line and the profile are Catmull-Rom splines turned into Bézier curves, rebuilt in real pixels on every resize. The gradient and the profile sit inside a clipPath whose rectangle widens with the tip of the pen.

The pen

The line draws itself with strokeDasharray and strokeDashoffset (with GSAP's autoRound switched off, or it jumps by whole pixels). The point rides the tip reading a table of 361 points taken with getPointAtLength, and the same table gives the cursor's y at any x.

The cursor on a spring

The cursor chases its target (the pointer or the walk on its own, a GSAP timeline) on a spring integrated by hand, stiffness 240 and damping 22; the pill chases the cursor on a second, softer spring and leans by as much as it lags behind.

Rolling digits

The value at the top is two columns of digits from 0 to 9 seen through a window one digit tall, with a mask fading above and below: when a digit changes its column slides with a back.out that passes the mark by a hair.

Values to change

NameFileDefaultWhat it changes
DRAWscript.js2.2The seconds the line takes to draw itself.
STIFFNESSscript.js240The spring pulling the cursor: higher is quicker.
DAMPINGscript.js22Lower lets the cursor pass the mark and come back.
LEANscript.js0.35How much the pill leans while the cursor runs.
DIPscript.js8.6How many points of oxygen the summit takes away.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the walk.

Try them in the Playground

When to use it

For a running, mountain or health app, for the dashboard of a smartwatch or a coach: the summary of a workout where one reading has to be read together with the route.

On phones

The same animation with adapted sizes: the card is as wide as the box, the chart is measured on the height too, and a finger drags the cursor along the run.

With reduced motion

Nothing moves: the line is already drawn, the cursor rests on the lowest reading with its pill, and the card fades in; with the pointer the cursor jumps where you take it, with no spring.

Pitfalls

  • GSAP rounds pixel values: without the line switching autoRound off the line would draw in jumps.
  • The profile and the line must be rebuilt in real pixels on every resize (the demo's window changes height while you watch), keeping the cursor at the same share of the run.
  • Near the summit the pill would cover the ‘Summit’ label: the label fades out while the pill passes over it.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.9 KB; the libraries: GSAP 28 KB.

Testing

Tested on 16 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All animations