Skip to content
animorio
IT
Back to the library

Puppy weight curve

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

The growth card of a puppy in the app of a made-up vet clinic, Fernwood Vets, in the clean style of the interface pieces: the weigh-ins of Miso, a fifteen-week-old Labrador, draw a green curve inside the healthy weight range, and from today the projection runs on in dots to week 24. Above the chart stand the three vaccine doses, two already given and the booster on November 27 in terracotta. The pointer reads one week at a time: the hairline reaches it on a spring, the point swells, the big number rolls to that week’s weight and the note says how much the puppy grew or which dose it had. Below, the Remind me button loads and turns green with a tick, and kg and lb swap with a sliding thumb.

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>
<!--
  "Puppy weight curve" 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 puppy weight curve with the healthy range and the vaccine booster</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 growth card of a puppy in the app of a made-up vet clinic, Fernwood Vets. The weigh-ins draw a curve inside
         the healthy range, the projection runs on dashed to week 24, the three vaccine doses stand on the chart and the
         pointer reads every week. Below, the next booster and its reminder button -->
    <article class="card" data-card>
      <header class="head">
        <div class="pet">
          <span class="pet__photo"><img src="cucciolo.webp" alt="A chocolate Labrador puppy" width="480" height="322"></span>
          <span class="pet__text">
            <span class="pet__name">Miso</span>
            <span class="pet__breed">Labrador, <span data-age>15 weeks</span></span>
          </span>
        </div>
        <div class="units" role="group" aria-label="Units" data-units>
          <span class="units__thumb" data-thumb aria-hidden="true"></span>
          <button class="units__btn is-on" type="button" data-unit="kg" aria-pressed="true">kg</button>
          <button class="units__btn" type="button" data-unit="lb" aria-pressed="false">lb</button>
        </div>
      </header>

      <div class="read">
        <div class="read__main">
          <span class="read__label" data-read-label>Weight today</span>
          <p class="read__value"><span class="read__num" data-num>12.0</span><span class="read__unit" data-num-unit>kg</span></p>
        </div>
        <div class="read__side">
          <span class="chip" data-chip>
            <svg class="chip__icon" viewBox="0 0 12 12" aria-hidden="true"><path data-chip-arrow d="M6 9.4V2.8M3.2 5.4 6 2.6l2.8 2.8"/></svg>
            <span data-chip-text>+0.9 kg this week</span>
          </span>
          <span class="range" data-range>Healthy 10.6 to 13.6 kg</span>
        </div>
      </div>

      <div class="chart" data-chart>
        <svg class="chart__svg" data-svg aria-hidden="true">
          <defs>
            <linearGradient id="band-fill" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="var(--green)" stop-opacity="0.16"/>
              <stop offset="1" stop-color="var(--green)" stop-opacity="0.07"/>
            </linearGradient>
            <linearGradient id="future-fill" x1="0" y1="0" x2="1" y2="0">
              <stop offset="0" stop-color="var(--ink)" stop-opacity="0.028"/>
              <stop offset="1" stop-color="var(--ink)" stop-opacity="0"/>
            </linearGradient>
            <clipPath id="reveal"><rect data-reveal x="0" y="-20" width="0" height="400"/></clipPath>
            <clipPath id="reveal-band"><rect data-reveal-band x="0" y="-20" width="0" height="400"/></clipPath>
          </defs>
          <g data-grid class="grid"></g>
          <rect data-future class="future" fill="url(#future-fill)"/>
          <g clip-path="url(#reveal-band)">
            <path data-band class="band" fill="url(#band-fill)"/>
            <path data-band-hi class="band-edge"/>
            <path data-band-lo class="band-edge"/>
          </g>
          <line data-today class="today"/>
          <g data-doses class="doses"></g>
          <g clip-path="url(#reveal)">
            <path data-proj class="proj"/>
            <path data-line-glow class="line-glow"/>
            <path data-line class="line"/>
          </g>
          <g data-points class="points"></g>
          <line data-hair class="hair"/>
          <circle data-mark class="mark" r="5"/>
        </svg>
        <div class="tags" data-tags aria-hidden="true"></div>
        <div class="axis" data-axis aria-hidden="true"></div>
        <div class="tip" data-tip aria-hidden="true">
          <span class="tip__top" data-tip-top>Week 12</span>
          <span class="tip__val" data-tip-val>8.9 kg</span>
          <span class="tip__sub" data-tip-sub>Within healthy range</span>
        </div>
      </div>

      <section class="next" data-next>
        <span class="next__icon" aria-hidden="true">
          <svg viewBox="0 0 24 24"><path d="M15.5 3.5l5 5M18 6l-2.6 2.6M16.6 9.4l-8.4 8.4-3.3.3.3-3.3 8.4-8.4 3 3ZM9.6 12.1l1.4 1.4M11.6 10.1l1.4 1.4M4.9 18.1l-1.4 1.4"/></svg>
        </span>
        <div class="next__text">
          <span class="next__title">Booster, Nov 27</span>
          <span class="next__when">Fri, DHPP + Rabies <span class="next__sep">at Fernwood Vets</span></span>
          <span class="next__track" aria-hidden="true"><span class="next__fill" data-fill></span></span>
        </div>
        <button class="remind" type="button" data-remind aria-pressed="false">
          <span class="remind__face" data-face>
            <span class="remind__spin" data-spin aria-hidden="true"></span>
            <svg class="remind__icon" viewBox="0 0 16 16" aria-hidden="true">
              <path class="remind__bell" data-bell d="M8 2.2c-2.2 0-3.6 1.6-3.6 3.7v2.4L3.2 10.6h9.6l-1.2-2.3V5.9C11.6 3.8 10.2 2.2 8 2.2ZM6.6 12.6c.3.7.8 1 1.4 1s1.1-.3 1.4-1"/>
              <path class="remind__check" data-check pathLength="1" d="M3.6 8.3l2.8 2.8 6-6.2"/>
            </svg>
            <span class="remind__words" data-words>Remind me</span>
          </span>
        </button>
      </section>
    </article>
    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"/></svg>
    <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.

31 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 “Puppy weight curve” 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 warm white ground sits a white card with a soft shadow and a green glow underneath. At the top the round photo of Miso, a chocolate Labrador puppy, with the name and Labrador, 15 weeks, and on the right the kg and lb switch. Below, Weight today and the big weight, 12.0 kg, with the green pill +0.9 kg this week and the healthy range written in grey. Then the chart: the healthy weight range in light green with dotted edges, the weigh-in curve from week 8 to today with white points ringed in green, and after the Today line the dotted projection to week 24 on a barely grey ground. At the top stand the vaccine doses: two labels with a tick, DHPP, and the terracotta label Due Nov 27 with a bell, each with a dashed thread down to the curve. On opening the range spreads from the left, the curve draws itself, the points pop one after another and the labels jump up with a small bounce while the number climbs from 4.3 to 12.0. Then a pointer reads the weeks: the vertical hairline follows it on a spring and settles, the read point swells, the dark note gives the week, the weight and the dose or the growth, and at the top the number rolls and the pill changes (+1.1 kg that week, First weigh-in, Projected, Booster due in terracotta). The pointer reaches the booster, then presses Remind me: the button squashes, the bell gives way to a spinning ring with Saving, then it turns green with a tick that draws itself and Reminder set, while the booster label swings. Last it taps lb: the thumb slides with a bounce, the number rolls to 26.5 lb and the scale changes, and back to kg.

How it works

The chart drawn in real pixels

The SVG has a viewBox as big as the chart box, recomputed by a ResizeObserver: the healthy range, the curve and the projection are Catmull-Rom curves turned into beziers, and the dose labels are HTML laid on top, kept inside the edges. So the lines stay thin at every width.

The hairline on a spring

The pointer picks the nearest week and the hairline reaches it on a hand-written spring in the GSAP ticker (stiffness and damping are two knobs): it arrives, overshoots by a pixel and comes back. A change of week swells the point, rolls the number with a tween and changes the pill.

The three-state button

Remind me goes from rest to loading to success: the pill width is measured before and after the label changes and GSAP takes it from one to the other with a back.out, the ring spins with an endless tween and the tick draws itself with stroke-dashoffset on pathLength 1.

Values to change

NameFileDefaultWhat it changes
DRAWscript.js1.8The seconds the weight curve takes to draw itself.
BANDscript.js0.12How wide the healthy range around the curve is, as a share of the weight.
STIFFscript.js230The spring of the hairline that follows the pointer: higher snaps faster.
DAMPscript.js21The spring damping: lower lets the hairline swing more before it stops.
POPscript.js1.6How much the point of the read week swells (1 for none).
--greenstyle.css#2f8a63The green of the curve, the healthy range and the set reminder.
--claystyle.css#d0643bThe terracotta of the vaccine booster.
--bgstyle.css#f2f0ebThe warm white of the ground.

Try them in the Playground

When to use it

For the app or client area of a vet, a pet shop or a breeder: whoever has a puppy sees whether it is growing well, when the next vaccine is due, and sets the reminder with one tap.

On phones

The same animation with adapted measures: the chart is sized on the height too, the labels of the doses already given become just the tick, the written healthy range and the clinic name hide below 440 pixels. With a finger you drag across the chart to read the weeks.

With reduced motion

No motion: the curve, the range and the doses are already in place and fade in; the hairline jumps straight to the week, the button and kg and lb change with fades, with no pointer moving on its own.

Pitfalls

  • The fake pointer is moved with left and top, not the transform: the tap shrinks it with GSAP, which writes its own transform and would wipe the move.
  • With Mona Sans no tabular-nums on the weights: the tabular zero has a slash, and 12.0 would show it.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 15 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