
The liquid grid
Hover, Transitions
Someone searched for “unit converter” and the site only found things close to it. Here is the unit converter of a made-up cooking app, Mise, in a single card on warm white: at the top the Weight, Volume and Temp categories in a segmented control with a sliding pill; below, two large rows, 250 g and 8.82 oz, with rolling digits. The value changes by dragging a thin ruler with ticks: you fling it, it glides and springs onto the tick under the needle. The button with two arrows turns half a turn and the two rows swap places; with Temp the ruler warms slightly from blue to terracotta, and a small line underneath says what it amounts to: “≈ 2 cups of flour”, “≈ gas mark 4”. Minimal style.
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>
<!--
"Unit converter" 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>Unit converter</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 unit converter of a made-up cooking app, Mise: three categories in a segmented control, the value and
its conversion in two rows that swap places, a thin ruler to drag with inertia and a spring on the ticks -->
<section class="card" data-card aria-labelledby="uc-title">
<header class="head">
<span class="brand"><svg viewBox="0 0 18 18" aria-hidden="true"><path d="M3 12.5h12M4.6 12.5a4.4 4.4 0 0 1 8.8 0M9 8.1V6.2M7.6 6.2h2.8"></path></svg>Mise</span>
<h1 class="head__title" id="uc-title">Converter</h1>
</header>
<div class="seg" role="tablist" aria-label="Category" data-seg>
<span class="seg__pill" data-pill aria-hidden="true"></span>
<button class="seg__btn" type="button" role="tab" data-cat="weight" aria-selected="true">Weight</button>
<button class="seg__btn" type="button" role="tab" data-cat="volume" aria-selected="false">Volume</button>
<button class="seg__btn" type="button" role="tab" data-cat="temp" aria-selected="false">Temp</button>
</div>
<div class="rows" data-rows>
<div class="row row--from" data-row="a">
<div class="row__num"><span class="roll" data-val></span><span class="row__sym" data-sym></span></div>
<span class="row__name" data-name></span>
</div>
<div class="rows__rule" aria-hidden="true"></div>
<div class="row row--to" data-row="b">
<div class="row__num"><span class="roll" data-val></span><span class="row__sym" data-sym></span></div>
<span class="row__name" data-name></span>
</div>
<button class="swap" type="button" data-swap aria-label="Swap units">
<span class="swap__bg" aria-hidden="true"></span>
<svg class="swap__ic" viewBox="0 0 20 20" aria-hidden="true" data-swap-ic>
<path d="M6.5 15.5V4.5M3.6 7.4l2.9-2.9 2.9 2.9"></path>
<path d="M13.5 4.5v11M10.6 12.6l2.9 2.9 2.9-2.9"></path>
</svg>
</button>
</div>
<div class="ruler" data-ruler role="slider" tabindex="0" aria-label="Amount" aria-valuemin="0" aria-valuemax="1000" aria-valuenow="250">
<span class="ruler__tint" data-tint aria-hidden="true"></span>
<div class="ruler__win">
<svg class="ruler__strip" data-strip aria-hidden="true"></svg>
</div>
<span class="needle" data-needle aria-hidden="true"><span class="needle__cap"></span></span>
</div>
<p class="hint"><span class="hint__approx" aria-hidden="true">≈</span><span class="hint__txt" data-hint></span></p>
</section>
<svg class="ptr" data-ptr viewBox="0 0 24 24" aria-hidden="true"><path d="M5.2 3.4l13 8.2-5.6 1.3 3.3 5.9-2.4 1.3-3.3-5.9-4 4.1z"></path></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>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.
27 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 “Unit converter” from Animorio and fit it into my siteThe ruler is an SVG as long as all the unit's ticks (one tick every TICK_GAP pixels), inside a window with a mask that fades the sides. The position is a number in the top row's unit: the strip moves with x = half the window minus the tick index times the gap. The ticks nearest the needle grow on a gaussian, recalculated at each step on nine ticks only.
While dragging the velocity is measured (moving average); on release the landing point is the position plus velocity times GLIDE, snapped to the nearest tick and kept within the limits. On a long trip a timeline goes a hair past with power3.out and comes back with elastic.out; on a short one a back.out is enough. Past the limits the drag gives a third, like a rubber band.
Each digit is a window one line tall holding the column from 0 to 9, moved with yPercent: when the value changes each digit rolls only as far as it needs, with a small delay from right to left. While the ruler runs the numbers follow the ticks, not the values in between.
A tween from 0 to 1 moves the two rows into each other's place, measuring the distance on every frame (so it holds even if the window changes height), with a back.out and a small shrink halfway; the colours swap along. At the end the units really invert and the transforms are cleared: the result is identical to the last frame.
| Name | File | Default | What it changes |
|---|---|---|---|
START_GRAMS | script.js | 250 | The starting weight, in grams. |
START_ML | script.js | 240 | The starting volume, in millilitres. |
START_C | script.js | 180 | The starting temperature, in degrees Celsius. |
TICK_GAP | script.js | 8 | The distance between two ruler ticks, in pixels. |
GLIDE | script.js | 0.3 | How far the ruler glides after a fling. |
SNAP_SPRING | script.js | 1.6 | How far it passes the tick before snapping onto it. |
ROLL_TIME | script.js | 0.5 | How long the digits take to roll, in seconds. |
SWAP_TIME | script.js | 0.75 | How long the two rows take to swap, in seconds. |
LOOP_PAUSE | script.js | 2.2 | The pause at the end of the loop before it starts again. |
--accento | style.css | #d0532a | The accent colour: needle, converted value, ≈ sign. |
In a recipe app or site, next to the ingredients; on a cooking or baking blog; in a shop for kitchen tools or scales; in a dashboard that has to convert measurements without a keyboard, with a thumb.
The card takes the width with a margin and the spacing, numbers and ruler also follow the height with clamp and vh; when the box is short the mark at the top hides, and under 340 pixels wide the unit names disappear. The ruler is rebuilt on every resize, and the swap measures the distance between the rows on every frame. The ruler is dragged with a finger (touch-action pan-y lets the page scroll vertically).
No glides, springs or rolling digits: the ruler can still be dragged but stops straight on the tick, the numbers change at once, the swap and the category change are fades, and the self-running loop does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.
Tested on 22 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.