
The elastic button
Buttons, Hover, Text
The last-order card of a grocery shop, on white, in the style of product interface pieces, with real photos of the four products: pressing Reorder sends every photo out of its tile in an arc into the button, which swallows it with a little gulp while the counter rolls, until green fills the button and the label turns into «Added to cart».
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>
<!--
"Reorder 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>The Reorder button that gathers the order</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>
<!-- a past order of a grocery app: pressing Reorder sends every product flying in an arc into the button,
which swallows each one with a little gulp while its counter rolls up, then turns into «Added to cart» -->
<section class="order" data-card aria-label="Your last order from Lindengrove Market">
<header class="order__head">
<svg class="order__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.5c-4.4-2.2-7-5.6-7-9.6 3.2 0 5.6 1.4 7 3.8 1.4-2.4 3.8-3.8 7-3.8 0 4-2.6 7.4-7 9.6Z"></path><path d="M12 14.7V4.2"></path><path d="M12 7.6c-1.2-1.6-2.8-2.4-4.6-2.4"></path></svg>
<div class="order__title">
<p class="order__brand">Lindengrove Market</p>
<p class="order__when">Delivered Tue, Oct 21</p>
</div>
<p class="order__state">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 12.6 9.8 16.8 18.6 7.6"></path></svg>
Delivered
</p>
</header>
<ul class="items" data-items>
<li class="item" data-item>
<div class="item__tile" data-tile>
<img class="item__art" src="oat-milk.webp" alt="A small glass bottle of oat milk with a gold cap on a wooden table" width="360" height="360" decoding="async">
</div>
<p class="item__name">Oat milk</p>
<p class="item__qty">2 x $3.20</p>
</li>
<li class="item" data-item>
<div class="item__tile" data-tile>
<img class="item__art" src="sourdough.webp" alt="A floury round sourdough loaf with a scored crust on a white plate" width="360" height="360" decoding="async">
</div>
<p class="item__name">Sourdough</p>
<p class="item__qty">1 x $6.50</p>
</li>
<li class="item" data-item>
<div class="item__tile" data-tile>
<img class="item__art" src="lemons.webp" alt="A lemon cut in two halves with two green leaves on white" width="360" height="360" decoding="async">
</div>
<p class="item__name">Lemons</p>
<p class="item__qty">1 x $2.40</p>
</li>
<li class="item" data-item>
<div class="item__tile" data-tile>
<img class="item__art" src="coffee.webp" alt="A small cotton drawstring bag full of roasted coffee beans on old wood" width="360" height="360" decoding="async">
</div>
<p class="item__name">Coffee</p>
<p class="item__qty">1 x $8.50</p>
</li>
</ul>
<div class="order__total">
<p>5 items</p>
<p class="order__sum">$23.80</p>
</div>
<button class="reorder" type="button" data-reorder aria-live="polite">
<span class="reorder__fill" data-fill aria-hidden="true"></span>
<span class="reorder__icon" data-icon aria-hidden="true">
<svg class="reorder__cart" data-cart viewBox="0 0 24 24"><path d="M3.5 4.5h2.2l2.2 10.2a1.6 1.6 0 0 0 1.6 1.3h7.7a1.6 1.6 0 0 0 1.5-1.2l1.6-6.3H7"></path><circle cx="10" cy="19.4" r="1.3"></circle><circle cx="17" cy="19.4" r="1.3"></circle></svg>
<svg class="reorder__check" viewBox="0 0 24 24"><path data-check d="M5.5 12.6 9.8 16.8 18.6 7.6"></path></svg>
</span>
<span class="reorder__labels">
<span class="reorder__label" data-label-a>Reorder</span>
<span class="reorder__label reorder__label--done" data-label-b>Added to cart</span>
</span>
<span class="reorder__count" data-count aria-hidden="true"><span class="reorder__digit" data-digit>0</span></span>
</button>
</section>
<div class="flyers" data-flyers aria-hidden="true"></div>
<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"></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.
30 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 “Reorder button” from Animorio and fit it into my siteThe photo does not move: for each product the script copies its image into a layer above the card, in the same place and at the same size, and flies the copy. So the tile stays put, the photo dims and loses its colour with a saturate filter, the tile gets its green mark and the grid never shifts.
The flight is a quadratic Bézier curve: the start is the tile, the end is the button’s counter, the control point halfway and ARC pixels higher. A tween runs a clock from 0 to 1 with power1.inOut and on every frame computes x and y on the curve, the scale going down to 28% and a rotation that goes and comes back.
When a copy arrives it disappears and the button swells to GULP in a tenth of a second and comes back with elastic.out, while the cart jolts, turning on its base. The counter changes like a drum: the old digit rises and leaves, the new one comes from below with back.out.
The green background is a layer under the labels with a circle clip-path that starts from zero right under the counter and grows to 150%. Together the cart flies off, the check draws itself with strokeDashoffset and the two labels swap like a drum, the new one widening on the wdth axis.
A timeline with repeatRefresh takes the drawn pointer to the button reading its real position every time, presses it by calling the same function as a real click, waits for the flight and the pause and puts everything back. At the first real touch it stops, and it starts again after eight quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2f7a4f | The green of the button once the order is in the cart and of the marks on the tiles. |
FLY_TIME | script.js | 0.62 | The seconds each product takes to fly to the button. |
STAGGER | script.js | 0.17 | The seconds between one product leaving and the next. |
ARC | script.js | 70 | How many pixels the flight arc rises above the straight line. |
GULP | script.js | 1.05 | How much the button swells with every product that arrives. |
HOLD | script.js | 1.6 | The seconds the button stays on «Added to cart» before going back. |
For the orders page of an online shop or a grocery app, a café’s history with the takeaway order, the summary after delivery: anywhere a purchase can be made again with one tap.
The card takes the full width minus the margins up to 380 pixels, the four tiles stay in a row and narrow, spacing is measured in vmin and the button stays 48 pixels tall, easy for a finger. The flight is recomputed at every start from the real positions, so it works even if the window changes size.
No flights and no springs: the tiles dim and get their green mark with a fade, the counter goes straight to 5 and the button turns to «Added to cart» without movement; the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.7 KB; the libraries: GSAP 28 KB.
Tested on 7 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.