
The colour columns
Hover, SVG
A medicine’s dose in a vet clinic app: move the weight slider and the graduated syringe fills up to the dose, with the plunger arriving on a spring and settling, the marker showing the point on the scale and the millilitres counting in large type. The weight reads in kilos or pounds.
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>
<!--
"Weight-based dosage" 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>Weight-based dosage</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 dose of a vet clinic app: move the weight and the oral syringe fills up to the dose -->
<section class="ds" data-ds aria-label="Dose by weight">
<header class="ds__head">
<span class="ds__who"><strong>Miso</strong><span>Arloxin oral, <span data-outstrength>20</span> mg/mL</span></span>
<div class="ds__units" role="radiogroup" aria-label="Weight unit">
<i class="ds__thumb" data-thumb aria-hidden="true"></i>
<button type="button" role="radio" aria-checked="true" data-unit="kg">kg</button>
<button type="button" role="radio" aria-checked="false" data-unit="lb">lb</button>
</div>
</header>
<p class="ds__dose"><span class="ds__num"><b data-outdose>0.45</b><i>mL</i></span><span class="ds__mg"><b data-outmg>9</b> mg per dose<br>every 12 hours</span></p>
<svg class="ds__syringe" viewBox="0 -2 340 84" role="img" aria-label="Oral syringe filled to the dose" data-svg>
<g data-plunger>
<rect class="ds__rod" x="6" y="30" width="156" height="8" rx="2"></rect>
<rect class="ds__handle" x="158" y="8" width="8" height="52" rx="3.500"></rect>
<rect class="ds__stopper" x="0" y="13.500" width="10" height="41" rx="2.500"></rect>
<path class="ds__ribs" d="M3.500 16v36M6.500 16v36"></path>
</g>
<rect class="ds__liquid" x="30" y="13.500" width="0" height="41" data-liquid></rect>
<rect class="ds__gloss" x="30" y="17" width="0" height="5" rx="2.500" data-gloss></rect>
<path class="ds__barrel" d="M30 12h150M30 56h150M180 6v56M30 12v15h-11a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h11V56"></path>
<g class="ds__ticks" data-ticks></g>
<path class="ds__mark" d="M0 9l-4.500-7h9Z" data-mark></path>
</svg>
<div class="ds__weight">
<label class="ds__label" for="ds-weight">Weight</label>
<span class="ds__value"><b data-outweight>4.5</b> <span data-outunit>kg</span></span>
<input class="ds__range" id="ds-weight" type="range" min="1" max="40" step="0.5" value="4.5" data-range>
</div>
</section>
<span class="live" aria-live="polite" data-live></span>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
</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.
25 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Weight-based dosage” from Animorio and fit it into my siteThe dose is the weight times the milligrams per kilo, divided by the bottle’s strength. The weight always stays in kilos inside the script: pounds are only a way of writing it.
GSAP takes a single number, the millilitres on show, to the new dose on a spring. On every frame one function turns it into the liquid’s width, the position of plunger and marker and the big figure.
The scale’s ticks and numbers come from the syringe’s capacity: change the millilitres it holds and the scale redraws itself.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #ef6a4c | The colour of the liquid, the unit and the dose marker. |
MG_PER_KG | script.js | 2 | How many milligrams per kilo of weight (a number invented for the demo). |
STRENGTH | script.js | 20 | The bottle’s strength, in milligrams per millilitre. |
SYRINGE | script.js | 5 | How many millilitres the syringe holds. |
SPRING | script.js | 1 | How much the plunger bounces when the dose changes. |
In the app or site of a vet clinic, a pharmacy or a telehealth service, next to the prescription; in any calculator where one quantity depends on another and you want to show how much it is: fertiliser per litre of water, detergent per load, coffee per cup.
The card is at most 332 pixels wide and narrows with the screen; the big figure and the gaps are sized on height too, so it fits a short window. The slider is a real range input, with a 24 pixel knob, and lets the page scroll vertically.
Plunger, liquid and figure go straight to the new dose, with no spring and no counting; the unit tile moves at once. The demo’s pointer does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.0 KB; the libraries: GSAP 28 KB.
Tested on 28 November 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.
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.