
The inchworm menu
Menus, Hover, Transitions
The «Clear cart» button at the bottom of a cart summary with three line-drawn products, a mug, a candle and a linen tote. You hold it so you never clear it by mistake: the pill fills with brick red from the left, the label widens on the width axis, the trash lid lifts and the rows shiver slightly. At the end the items fly out on an arc one after the other, the total and the item count roll to zero, and an Undo with a five-second ring springs them back into place.
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>
<!--
"Clear cart button" 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>Clear cart button</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">
<!-- a small cart summary with a Clear cart button you have to hold: the pill fills from the left, the trash lid
lifts and the rows shiver; hold to the end and the items fly out, the totals roll to zero, Undo brings them back -->
<section class="cart" data-cart aria-label="Shopping cart">
<header class="cart__head">
<span class="cart__title">Your cart</span>
<span class="cart__count"><span class="roll" data-count><span class="roll__line">3 items</span></span></span>
</header>
<div class="cart__body" data-body>
<ul class="cart__list" data-list>
<li class="row" data-row>
<span class="row__inner" data-row-inner>
<span class="thumb" aria-hidden="true">
<svg viewBox="0 0 40 40"><path d="M11 13h15v13a4 4 0 0 1-4 4h-7a4 4 0 0 1-4-4V13Z"/><path d="M26 16h2.5a3 3 0 0 1 0 6H26"/><path d="M15 9.5c0-1.4 1.6-1.4 1.6-2.8M19.5 9.5c0-1.4 1.6-1.4 1.6-2.8" class="thumb__soft"/></svg>
</span>
<span class="row__text"><span class="row__name">Stoneware mug</span><span class="row__var">Sand · Qty 1</span></span>
<span class="row__price">$28.00</span>
</span>
</li>
<li class="row" data-row>
<span class="row__inner" data-row-inner>
<span class="thumb" aria-hidden="true">
<svg viewBox="0 0 40 40"><path d="M13 16h14v14H13z"/><path d="M13 20h14" class="thumb__soft"/><path d="M20 16v-3.5"/><path d="M20 12.5c-1.6-1.6-1.2-3.6 0-5.5 1.2 1.9 1.6 3.9 0 5.5Z" class="thumb__flame"/></svg>
</span>
<span class="row__text"><span class="row__name">Beeswax candle</span><span class="row__var">Fig leaf · Qty 1</span></span>
<span class="row__price">$34.00</span>
</span>
</li>
<li class="row" data-row>
<span class="row__inner" data-row-inner>
<span class="thumb" aria-hidden="true">
<svg viewBox="0 0 40 40"><path d="M10.5 16h19l-1.6 15h-15.8L10.5 16Z"/><path d="M15.5 16v-2a4.5 4.5 0 0 1 9 0v2"/><path d="M14 21.5h12" class="thumb__soft"/></svg>
</span>
<span class="row__text"><span class="row__name">Linen tote</span><span class="row__var">Natural · Qty 1</span></span>
<span class="row__price">$86.00</span>
</span>
</li>
</ul>
<div class="empty" data-empty aria-hidden="true">
<svg class="empty__bag" viewBox="0 0 40 40"><path d="M9.5 15h21l-1.8 16.5H11.3L9.5 15Z"/><path d="M15 15v-2.2a5 5 0 0 1 10 0V15"/></svg>
<span class="empty__title">Your cart is empty</span>
<span class="empty__sub">Saved items stay in your wishlist.</span>
</div>
</div>
<div class="cart__sum">
<span>Subtotal</span>
<span class="cart__total" data-total>$148.00</span>
</div>
<div class="pill-wrap">
<button class="pill" type="button" data-pill data-autoclic aria-describedby="hint">
<span class="pill__face" data-face>
<span class="pill__fill" aria-hidden="true"></span>
<span class="pill__label" data-label-base>
<svg class="bin" viewBox="0 0 16 16" aria-hidden="true"><g data-lid><path d="M2.6 4.2h10.8M6.3 4.2V2.9h3.4v1.3"/></g><path d="M3.9 5.9 4.6 13.4h6.8l.7-7.5M6.7 7.6v3.9M9.3 7.6v3.9"/></svg>
<span>Clear cart</span>
</span>
<span class="pill__label pill__label--on" aria-hidden="true">
<svg class="bin" viewBox="0 0 16 16"><g data-lid-on><path d="M2.6 4.2h10.8M6.3 4.2V2.9h3.4v1.3"/></g><path d="M3.9 5.9 4.6 13.4h6.8l.7-7.5M6.7 7.6v3.9M9.3 7.6v3.9"/></svg>
<span>Clear cart</span>
</span>
<span class="pill__done" data-done aria-hidden="true">
<svg class="tick" viewBox="0 0 16 16"><path data-tick pathLength="1" d="M3.4 8.4 6.6 11.4 12.6 4.8"/></svg>
<span>Cart cleared</span>
</span>
</span>
</button>
</div>
<div class="cart__foot">
<span class="hint" id="hint" data-hint>Hold to clear</span>
<button class="undo" type="button" data-undo tabindex="-1">
<svg class="undo__ring" viewBox="0 0 20 20" aria-hidden="true"><circle class="undo__track" cx="10" cy="10" r="7.5"/><circle class="undo__time" data-undo-time cx="10" cy="10" r="7.5" pathLength="1"/></svg>
<span>Undo</span>
</button>
</div>
<p class="sr" aria-live="polite" data-live></p>
</section>
</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.
37 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 “Clear cart button” from Animorio and fit it into my siteThe fill is one CSS variable, --p, from 0 to 1: the red background is a scaleX(var(--p)) from the left, the white label is a copy of the red one clipped with clip-path, the label widens with font-stretch: calc(100% + var(--p) * 20%) and the pill’s shadow tightens with the same variable.
On press GSAP takes p to 1 in HOLD seconds with power1.in; the trash lid turns around its hinge with svgOrigin in the icon’s coordinates, and the rows shiver with two sines on the ticker, harder towards the end. Let go early and p goes back to 0 with elastic.out.
Each row flies with three overlapping tweens: x speeding up to the right, y with three keyframes (up, then down) for the arc, rotation and opacity; rows leave STAGGER seconds apart.
The Undo ring is a circle with pathLength 1 whose stroke-dashoffset goes from 0 to 1 in UNDO_TIME seconds. Undoing brings the rows back last to first with elastic.out while the total climbs back.
| Name | File | Default | What it changes |
|---|---|---|---|
HOLD | script.js | 1.4 | Seconds of holding to fill the pill and clear the cart. |
UNDO_TIME | script.js | 5 | Seconds Undo stays available, shown by the ring around it. |
FLY | script.js | 0.75 | Seconds each item takes to fly out of the cart. |
STAGGER | script.js | 0.09 | Seconds between one item and the next. |
LID | script.js | 32 | Degrees the trash lid lifts while you hold. |
SHIVER | script.js | 0.9 | Pixels the rows shiver at the end of the hold. |
SPRING | script.js | 0.45 | How springy the pill is when you let go early (lower = more bounce). |
At the bottom of an online shop’s cart, in an order summary or in any list you can empty in one go (mail, downloads, notifications): an action that removes a lot and wants a stronger confirmation than a click, without a dialog.
Everything is in em and the size depends on both the width and the height of the window, so the cart fits the phone box. A finger holds like the mouse.
No springs, flights or shivers: the pill fills and empties without bouncing, the lid stays still, the items fade out and back and the numbers change at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.9 KB; the libraries: GSAP 28 KB.
Tested on 26 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.