
The elastic button
Buttons, Hover, Text
The last order card of a made-up online grocer, Fernhill Grocer, on white: three real product photos (sourdough, avocados, eggs) and a black Order again pill with a cart drawn inside. On tap the photos lift off one after another, fly on a spring arc and shrink until they dive into the cart, which jolts at every arrival; the orange number climbs 1, 2, 3 and the total rolls digit by digit up to €18.40. Then the pill says Added, 3 items with the tick drawing itself, and after a moment the photos settle back into their places with a little spring.
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>
<!--
"Order again 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 Order again button with last time's groceries flying back into the cart</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 last order of an online grocer: pressing Order again lifts each photo off its slot, sends it in a spring arc
into the cart drawn inside the pill, the cart dips at each arrival, the badge counts and the total rolls -->
<section class="order" data-card aria-label="Your last order from Fernhill Grocer">
<header class="order__head">
<span class="order__mark" aria-hidden="true">
<svg viewBox="0 0 24 24"><path d="M12 20.4V9.2"></path><path d="M12 13.6c-3.6 0-6-2.2-6.4-5.8 3.6 0 6 2 6.4 5.8Z"></path><path d="M12 10.8c.4-3.6 2.8-5.6 6.4-5.6-.4 3.6-2.8 5.6-6.4 5.6Z"></path></svg>
</span>
<div class="order__title">
<p class="order__brand">Fernhill Grocer</p>
<p class="order__when">Last order, 28 Oct</p>
</div>
<p class="order__state">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.6 7.4h10.2v8.8H3.6Z"></path><path d="M13.8 10.2h3.6l3 3.2v2.8h-6.6"></path><circle cx="7.2" cy="17.4" r="1.6"></circle><circle cx="16.8" cy="17.4" r="1.6"></circle></svg>
Delivered
</p>
</header>
<ul class="items">
<li class="item" data-item data-price="6.20">
<div class="slot" data-slot>
<span class="slot__ghost" aria-hidden="true"></span>
<div class="thumb" data-thumb><img src="pane.webp" width="520" height="520" alt="A sourdough loaf" draggable="false"><span class="thumb__shine" aria-hidden="true"></span></div>
</div>
<p class="item__name">Sourdough</p>
<p class="item__qty">1 loaf · €6.20</p>
</li>
<li class="item" data-item data-price="4.80">
<div class="slot" data-slot>
<span class="slot__ghost" aria-hidden="true"></span>
<div class="thumb" data-thumb><img src="avocado.webp" width="520" height="520" alt="Ripe avocados" draggable="false"><span class="thumb__shine" aria-hidden="true"></span></div>
</div>
<p class="item__name">Avocados</p>
<p class="item__qty">2 pcs · €4.80</p>
</li>
<li class="item" data-item data-price="7.40">
<div class="slot" data-slot>
<span class="slot__ghost" aria-hidden="true"></span>
<div class="thumb" data-thumb><img src="uova.webp" width="520" height="520" alt="Brown farm eggs in a tray" draggable="false"><span class="thumb__shine" aria-hidden="true"></span></div>
</div>
<p class="item__name">Farm eggs</p>
<p class="item__qty">6 pcs · €7.40</p>
</li>
</ul>
<button class="again" type="button" data-again aria-live="polite">
<span class="again__body" data-body>
<span class="again__glint" aria-hidden="true"><span class="again__band" data-band></span></span>
<span class="again__cart" data-cartwrap aria-hidden="true">
<span class="again__disc" data-disc></span>
<svg class="again__icon" data-cart viewBox="0 0 24 24">
<path class="cart__basket" d="M3.4 4.6h2.1l2.1 9.9a1.7 1.7 0 0 0 1.7 1.3h7.4a1.7 1.7 0 0 0 1.6-1.2l1.6-6.4H6.4"></path>
<circle cx="9.8" cy="19.3" r="1.3" data-wheel></circle><circle cx="16.8" cy="19.3" r="1.3" data-wheel></circle>
</svg>
<span class="again__badge" data-badge><span class="again__badge-n" data-badge-n>0</span></span>
</span>
<span class="again__labels">
<span class="again__label" data-label-a>Order again</span>
<span class="again__label again__label--done" data-label-b>
<svg class="again__check" viewBox="0 0 24 24" aria-hidden="true"><path data-check d="M5.4 12.8 9.8 17 18.6 7.6"></path></svg>
Added, 3 items
</span>
</span>
<span class="again__total" data-total aria-hidden="true"></span>
</span>
</button>
</section>
<div class="flyers" data-flyers aria-hidden="true"></div>
</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.
28 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 “Order again button” from Animorio and fit it into my siteEach photo flies on a quadratic Bézier curve: start at the centre of its box, end in the cart's basket, control point ARC pixels higher and shifted towards the start, so the photo first rises and then falls. Both ends are read again with getBoundingClientRect every frame: if the window changes size mid flight, the arc still ends in the cart.
Along the flight a single number gives the scale (down to 20 pixels, with a curve that shrinks faster at the start), the corner radius going from 16 pixels to half the side and a sine rotation that returns to zero on arrival; a clone of the image flies above the card while the starting box leaves its dashed outline.
At every arrival the SVG cart drops three pixels and turns nine degrees around the wheels in eight hundredths of a second, then comes back with elastic.out: a jolt as of something dropped in. The disc behind swells and brightens, the pill gives by half a pixel.
Each figure of the total is a column of ten digits inside a one line window: GSAP moves it with yPercent and back.out, the columns slightly out of step from right to left like an odometer. The first figure only takes space from ten euros up, animating its width.
The two labels sit on top of each other in a window: the first leaves upwards, the second comes in from below tightening with Mona Sans's font-stretch, the tick draws itself with stroke-dashoffset. On the way back the photos reappear with a scale from 0.72 and elastic.out, nine hundredths apart.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | "#ff6b2c" | The colour of the number on the cart, the tick and the full cart. |
FLY_TIME | script.js | 0.74 | The seconds each photo takes to fly into the cart. |
STAGGER | script.js | 0.26 | The seconds between one photo leaving and the next. |
ARC | script.js | 90 | How many pixels the arc rises above the straight line. |
BUMP | script.js | 1 | How much the cart jolts at every arrival: 0 none, 2 double. |
HOLD | script.js | 1.8 | The seconds the button stays on Added, 3 items before going back. |
AUTO | script.js | true | The reorder plays by itself, in a loop, until someone touches the button. |
On the orders page of an online grocer or supermarket, in a grocery app, in the history of a shop for coffee, cosmetics or pet food: anywhere people buy the same things again and reordering in one tap is the gesture worth feeling.
The same card, almost as wide as the screen and sized on the height too, with the three photos a little smaller and the pill still 60 pixels tall: the photos fly on the same arc inside the card. A tap reorders; the hover is only there where there is a pointer.
No flights, no jolts or springs: the photos fade out leaving the dashed outline, the number is 3 at once and the total €18.40, the labels swap with a fade and the tick already drawn, then the photos fade back in.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.1 KB; the libraries: GSAP 28 KB.
Tested on 5 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.