Skip to content
animorio
IT
Back to the library

Bundle builder

Hover, TransitionsGSAP, CSS onlyAdvancedCompressed weight: Demo 6.4 KBGSAP 28 KBFreeDownload the zip

The build-your-own bundle of a shop for design assets: four products and a tray with three places. Each product picked flies from its tile to the first free place and lands on a spring; with every place filled a bar lights up and the discount steps up (10% with two, 20% with three), while the price rolls and the full one stays struck through above it. Remove one and the others shift along.

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>
<!--
  "Bundle builder" 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>Bundle builder</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">
    <!-- build-your-own bundle in a shop for design assets: each product picked flies into the next free slot
         of the tray, the discount steps up with every slot filled and the price rolls -->
    <section class="bb" data-bb aria-labelledby="bb-title">
      <header class="bb__head">
        <span class="bb__name"><b id="bb-title">Build your bundle</b><span class="bb__hint"><span data-hint>Pick 3 and save 20%</span></span></span>
        <span class="bb__price"><s data-full></s><b data-total>€0</b></span>
      </header>

      <div class="bb__grid" role="group" aria-label="Products">
        <button class="bb__item" type="button" aria-pressed="false" data-item data-price="39">
          <span class="bb__art" data-art aria-hidden="true"><svg viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="14" rx="2.500"></rect><path d="M4 9.500h16M8 13h4M8 15.800h7"></path></svg></span>
          <b>UI kit</b><span>€39</span>
        </button>
        <button class="bb__item" type="button" aria-pressed="false" data-item data-price="19">
          <span class="bb__art" data-art aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 4.500 14.300 9.300l5.200.700-3.800 3.600.9 5.200L12 16.300l-4.600 2.500.9-5.200L4.500 10l5.200-.700Z"></path></svg></span>
          <b>Icon set</b><span>€19</span>
        </button>
        <button class="bb__item" type="button" aria-pressed="false" data-item data-price="29">
          <span class="bb__art" data-art aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M6 18.500 11 5.500h2l5 13M8 14h8"></path></svg></span>
          <b>Typeface</b><span>€29</span>
        </button>
        <button class="bb__item" type="button" aria-pressed="false" data-item data-price="24">
          <span class="bb__art" data-art aria-hidden="true"><svg viewBox="0 0 24 24"><rect x="4.500" y="5.500" width="15" height="13" rx="2.500"></rect><path d="m5 16 4.200-4.200 3.300 3.300 2.200-2.200 4.300 4.100M15 9.300v.200"></path></svg></span>
          <b>Mockups</b><span>€24</span>
        </button>
      </div>

      <div class="bb__tray">
        <div class="bb__slots" data-slots>
          <span class="bb__slot" data-slot></span>
          <span class="bb__slot" data-slot></span>
          <span class="bb__slot" data-slot></span>
        </div>
        <div class="bb__tier">
          <span class="bb__steps" aria-hidden="true"><i data-step></i><i data-step></i><i data-step></i></span>
          <span class="bb__off" aria-live="polite"><span data-off>No discount yet</span></span>
        </div>
      </div>

      <div class="bb__foot">
        <button class="bb__clear" type="button" data-clear disabled>Clear</button>
        <button class="bb__go" type="button" data-go disabled><span class="bb__gotext"><span data-golabel>Add bundle to cart</span></span></button>
      </div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

26 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Bundle builder” 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 a warm pale ground, a white card: “Build your bundle”, “Pick 3 and save 20%” and on the right the price, “€0”. Four tiles in a row, each with a line drawing on a white chip, the name and the price: “UI kit €39”, “Icon set €19”, “Typeface €29”, “Mockups €24”. Below, a tray with three dashed places, three bars and “No discount yet”. Touch “UI kit” and the tile takes a magenta edge, its chip fades and a copy with the name flies into the first place, grows to fill it and settles on a spring; the first bar lights up, “Add one more for 10% off”, the price rolls to “€39”. With the second product: “10% off, one more for 20%”, the full price appears struck through above and the real one rolls lower. With the third: “20% off unlocked”, “Bundle complete”, and the product left out fades. Touch a chosen product again and its chip leaves the tray and the ones after it slide along to take the place. “Add bundle to cart” answers “3 items added to cart”; “Clear” empties the tray.

How it works

The state is a list

The chosen products sit in a list, in the order they were picked. From it one function works out the full price, the discount, the total, the bars and the words; another rebuilds the tray.

The flight (FLIP)

The chip is put in its real place, then where it was is measured (the product’s tile if it is new, the previous place if it moves) and it starts from there: x, y and scale return to zero with FLY and a spring.

Shifting along

Removing a product makes the ones after it change container: the same measure before and after makes them slide instead of jumping.

The stepped discount

Three bars with the fill in a CSS variable, and the sentence that always says how far the next step is.

The price

A number taken to the new total by a tween and written on every frame; at the end the exact one is written, with cents if needed.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#d6336cThe colour of the chosen products, of the bars and of the discount.
TWOscript.js10The discount in percent with two products.
THREEscript.js20The discount in percent with three products.
FLYscript.js0.7How long a product’s flight from its tile to the tray lasts.
SPRINGscript.js1How much the product bounces when it lands: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer fills the tray, swaps a product and empties it.

Try them in the Playground

When to use it

In shops that sell in sets: cosmetics, coffee, socks, supplements, digital assets, courses. On the bundle page or inside a product page, when the discount grows with the number of items picked.

On phones

The same card, as wide as the screen minus the margins: the four products stay in one row (under 340 pixels names and chips tighten), the flight is measured at the moment of the touch, so it works at any width.

With reduced motion

No flights and no springs: the chip fades in at its place, the ones that shift change place in one step, bars, words and price go straight to the new value. The demo does not move by itself.

Pitfalls

  • Shop, products and prices are made up and nothing goes into the cart: in a real shop the cart works out the discount, and this card only shows it.
  • A full tray is said in three ways: “Bundle complete”, the product left out fading, and a small shake if it is touched anyway.
  • The chosen products are buttons with aria-pressed: the same touch adds and removes, from the keyboard too.
  • While counting the price is rounded to the euro, at the end the exact one is written: otherwise the cents flicker.
  • The chip in the tile fades with CSS, the one in the tray is another element moved by GSAP: the two transforms never meet.
  • Before measuring a chip its tweens are stopped and it is put back to zero, otherwise a position half way through a flight is measured.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.4 KB; the libraries: GSAP 28 KB.

Testing

Tested on 24 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 animations