
The inchworm menu
Menus, Hover, Transitions
The bag of an invented ceramics shop, Oda Clay, on white: a mug and a vase, the subtotal, the shipping and the total. In the corner the currency pill, with the symbol on a small clay coin, opens a glass list of five currencies, each with the total already worked out. Pick one and the coin flips to the new symbol and every price in the bag rolls digit by digit, lined up on the decimal point: the yen folds the cents away and grows digits on the left, and a light runs over the total once it has settled.
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>
<!--
"Store currency switcher" 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 store currency switcher with the prices that roll</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 bag of Oda Clay, an invented ceramics studio shop: the currency pill in the corner opens a glass list of
five currencies, each with the bag total already worked out; picking one flips the coin in the pill and rolls
every price of the bag, digit by digit, to the new currency -->
<section class="bag" data-bag aria-labelledby="bag-title">
<span class="bag__glow" aria-hidden="true"></span>
<header class="bag__head">
<span class="bag__mark" aria-hidden="true">
<svg viewBox="0 0 20 20"><path d="M5.2 7.4h9.6l-.9 8.1a1.4 1.4 0 0 1-1.4 1.2H7.5a1.4 1.4 0 0 1-1.4-1.2z"/><path d="M7.6 7.4V6a2.4 2.4 0 0 1 4.8 0v1.4"/></svg>
</span>
<span class="bag__meta">
<span class="bag__title" id="bag-title">Your bag</span>
<span class="bag__sub">Oda Clay · 2 items</span>
</span>
<button class="cur" type="button" data-pill aria-haspopup="listbox" aria-expanded="false" aria-controls="cur-list">
<span class="cur__coin" data-coin aria-hidden="true"><span class="cur__sym" data-coin-sym>€</span></span>
<span class="cur__code" data-pill-code>EUR</span>
<svg class="cur__chev" data-chev viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.5 8 10l3.5-3.5"/></svg>
<span class="sr" data-pill-name>Currency: Euro</span>
</button>
</header>
<ul class="bag__items">
<li class="item">
<span class="item__thumb item__thumb--mug" aria-hidden="true">
<svg viewBox="0 0 48 48">
<defs>
<linearGradient id="mug-body" x1="0" x2="1">
<stop offset="0" stop-color="#d9cdbb"/><stop offset=".45" stop-color="#f4ede2"/><stop offset="1" stop-color="#c3b59f"/>
</linearGradient>
</defs>
<ellipse class="item__shadow" cx="23" cy="38.6" rx="11.5" ry="2.2"/>
<path d="M31.4 18.6h2.4a4.6 4.6 0 0 1 0 9.2h-2.6" fill="none" stroke="#c9bba6" stroke-width="2.4" stroke-linecap="round"/>
<path d="M13.2 15.4h19.6v18.4a4.4 4.4 0 0 1-4.4 4.4H17.6a4.4 4.4 0 0 1-4.4-4.4z" fill="url(#mug-body)"/>
<ellipse cx="23" cy="15.4" rx="9.8" ry="1.9" fill="#e9dfd0"/>
<ellipse cx="23" cy="15.6" rx="8.4" ry="1.2" fill="#8a7a66" opacity=".55"/>
<path d="M16.4 20v12.6" stroke="#fff" stroke-width="1.4" stroke-linecap="round" opacity=".7"/>
<g fill="#8b7a63" opacity=".45"><circle cx="20" cy="23" r=".45"/><circle cx="26.5" cy="20.4" r=".4"/><circle cx="28.6" cy="29.2" r=".45"/><circle cx="22.8" cy="31.6" r=".35"/><circle cx="18.6" cy="27.8" r=".4"/><circle cx="25.4" cy="25.6" r=".35"/></g>
</svg>
</span>
<span class="item__text">
<span class="item__name">Speckled mug</span>
<span class="item__var">Oat glaze · 350 ml</span>
</span>
<span class="price" data-eur="28"><span class="price__sym"></span><span class="price__int"></span><span class="price__frac"></span></span>
</li>
<li class="item">
<span class="item__thumb item__thumb--vase" aria-hidden="true">
<svg viewBox="0 0 48 48">
<defs>
<linearGradient id="vase-body" x1="0" x2="1">
<stop offset="0" stop-color="#2c3a3c"/><stop offset=".42" stop-color="#5b7471"/><stop offset=".62" stop-color="#3e5352"/><stop offset="1" stop-color="#1f2a2b"/>
</linearGradient>
</defs>
<ellipse class="item__shadow" cx="24" cy="40" rx="9.5" ry="2"/>
<path d="M20.6 8.6h6.8v3.6c0 2.2 6.6 5.2 6.6 13.4 0 7.6-4 13.6-10 13.6s-10-6-10-13.6c0-8.2 6.6-11.2 6.6-13.4z" fill="url(#vase-body)"/>
<ellipse cx="24" cy="8.7" rx="3.4" ry=".9" fill="#7d9592"/>
<path d="M19.4 20.6c-1.6 2.2-2.4 4.8-2.2 8" stroke="#fff" stroke-width="1.3" stroke-linecap="round" fill="none" opacity=".45"/>
</svg>
</span>
<span class="item__text">
<span class="item__name">Tall bud vase</span>
<span class="item__var">Moss glaze · 22 cm</span>
</span>
<span class="price" data-eur="64"><span class="price__sym"></span><span class="price__int"></span><span class="price__frac"></span></span>
</li>
</ul>
<dl class="bag__sums">
<div class="sum"><dt>Subtotal</dt><dd class="price price--sm" data-sum="items"><span class="price__sym"></span><span class="price__int"></span><span class="price__frac"></span></dd></div>
<div class="sum"><dt>Shipping</dt><dd class="price price--sm" data-eur="6.5"><span class="price__sym"></span><span class="price__int"></span><span class="price__frac"></span></dd></div>
</dl>
<div class="bag__total">
<span class="bag__total-label">Total<small data-note>Charged in EUR</small></span>
<span class="price price--big" data-sum="all"><span class="price__sym"></span><span class="price__int"></span><span class="price__frac"></span></span>
<span class="bag__sheen" data-sheen aria-hidden="true"></span>
</div>
<button class="pay" type="button">
<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="3.6" y="7.2" width="8.8" height="6.4" rx="1.6"/><path d="M5.6 7.2V5.4a2.4 2.4 0 0 1 4.8 0v1.8"/></svg>
<span>Checkout</span>
</button>
<div class="pop" data-pop hidden>
<p class="pop__head">Show prices in</p>
<div class="pop__list" id="cur-list" role="listbox" tabindex="-1" aria-label="Currency" data-list>
<span class="pop__hi" data-hi aria-hidden="true"></span>
</div>
<p class="pop__foot">Rates updated 4 min ago</p>
</div>
</section>
<p class="sr" aria-live="polite" data-live></p>
<svg class="pilot" data-pilot viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5v15.2l4.1-3.9 2.7 6 2.6-1.1-2.7-5.9h5.7z"/></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.
34 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 “Store currency switcher” from Animorio and fit it into my siteEvery price is three parts: the symbol, the whole part and the cents. The whole part counts its slots from the decimal point leftwards, the cents from the point rightwards: so when the currency changes the digits stay lined up on the point, and the yen, which has no cents, folds them away and grows thousands on the left.
Each digit is a one line window holding a column from 0 to 9: to show the digit n the column rises by n tenths (yPercent -10 times n) with back.out (BOUNCE) in ROLL seconds, staggered by STAGGER from left to right and by ROW_DELAY from one price to the next. A mask fades the top and bottom of the window, so the digits come out of a soft edge.
When the number gets longer, the new slot is measured, starts zero wide and widens while its column rolls in from the opposite value; when it gets shorter, the extra slot narrows to zero and is then removed. The thousands commas are fixed slots that come and go the same way.
Each line is converted and rounded on its own, and the subtotal and total are the sum of the rounded lines, as a real till does: the total is never a cent off. The list also shows the bag total in every currency, worked out the same way.
The coin in the pill narrows to its edge (scaleX), changes symbol and opens again with a bounce, while the code rolls. The list is a real listbox with arrows, Home, End, Enter and Esc; the highlight follows the active option on a spring and the tick draws itself with stroke-dashoffset.
A drawn pointer goes through dollar, yen, pound and back to euro; at the first real move, tap or key it stops. The whole card scales to fit the window, height included, measured again on resize.
| Name | File | Default | What it changes |
|---|---|---|---|
ROLL | script.js | 0.8 | Seconds for a digit to roll to its new value. |
STAGGER | script.js | 0.045 | Seconds between one digit and the next, from left to right. |
ROW_DELAY | script.js | 0.08 | Seconds between one price of the bag and the next. |
BOUNCE | script.js | 1.4 | How far the digits and the list go past their mark before settling (0 none). |
OPEN | script.js | 0.5 | Seconds for the list to drop from the pill. |
FLIP | script.js | 0.5 | Seconds for the coin in the pill to flip to the new symbol. |
HOLD | script.js | 2.6 | Seconds the pilot leaves each currency on screen. |
SPEED | script.js | 1 | Pilot speed. |
LOOP | script.js | true | The pilot starts over. |
In the cart, the checkout or the product page of an online shop that sells abroad: visitors from another country choose their currency and see every price change at once, without reloading the page. It also works on the pricing page of a subscription service or in a hotel booking with guests from abroad.
The same animation with adapted sizes: the card scales to fit the window both in width and height, so it fits the phone box with the list open. A finger opens the pill and picks the currency; the pill widening on hover only happens where there is a mouse.
Nothing rolls and nothing moves: the new prices fade in already in place, the coin and the code change with a fade, the list appears and disappears without dropping and the light over the total does not run; the pilot's pointer is hidden.
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.
Tested on 9 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.
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.