Skip to content
animorio
IT
All components

Reorder button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.7 KBGSAP 28 KBFreeDownload the zip

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».

The code

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>

Playground

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

Or ask your AI assistant for it

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 site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On white sits the last-order card of Lindengrove Market, an invented grocery shop: the leaf mark, «Delivered Tue, Oct 21» and the Delivered pill with its check. Below, four paper-coloured tiles, each with a real photo of its product laid in like a small print with a shadow: the little bottle of oat milk with its gold cap, the floury sourdough loaf on a plate, the lemon cut in two with its leaves and the cotton bag full of coffee beans, each with its name and quantity. Then «5 items» and the total, $23.80, and the black Reorder button with its cart. Pressing it squashes the button and springs it back, a small pill with a counter appears beside the label, and the products leave one after another: each photo lifts a touch from its tile, a copy flies in an arc into the button, shrinking and turning slightly, with its shadow coming away halfway; the oat milk leaves twice, because there are two bottles. On every arrival the button swells and springs back, the cart jolts and the number rolls up by one, up to 5; the photo left behind dims and loses its colour and the tile gets a small green mark. At the end the green fills the button spreading out from the counter, the cart flies off upwards, the check draws itself and «Reorder» rises while «Added to cart» comes up from below, widening. After a moment everything goes back as it was and the photos get their colour back. A drawn pointer presses it on its own and starts again; it also works with a click, a tap and the keyboard.

How it works

A copy that flies

The 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 arc

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.

The gulp

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 that spreads

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.

The autopilot

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.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2f7a4fThe green of the button once the order is in the cart and of the marks on the tiles.
FLY_TIMEscript.js0.62The seconds each product takes to fly to the button.
STAGGERscript.js0.17The seconds between one product leaving and the next.
ARCscript.js70How many pixels the flight arc rises above the straight line.
GULPscript.js1.05How much the button swells with every product that arrives.
HOLDscript.js1.6The seconds the button stays on «Added to cart» before going back.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • Flying the real photo took an item out of the tile grid and made it shift: a copy of the image flies in a layer above the card.
  • The photos are cropped square around the product and small (360 pixels, a few kB each): in the tile they sit with object-fit: cover, and the flying copy is already loaded because it is the same image.
  • In Mona Sans tabular figures draw a slashed zero: the counter uses normal figures, and the drum has a minimum width so it does not jump.

Libraries

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.

Testing

Tested on 7 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All components