
The star rating
Ratings, SVG, Hover
A light pill button for the page of a product you can buy in a set: inside it has a small tray with what is already in the bundle and the discount reached. Pressed, the two squares of the sign slide over each other on a spring, this product’s tile drops into the tray pushing the other aside, the discount rolls from −5% to −10% and the label says ‘In your bundle’; pressed again, the tile leaves and everything goes back.
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>
<!--
"Add to bundle 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>Add to bundle button with the tile that drops into the tray and the discount that climbs</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">
<!-- an add-to-bundle button for a product page: the pill holds a small tray with what is already in the bundle
and the discount earned so far; pressed, the two squares of the sign slide over each other on a spring, this
product's tile drops into the tray pushing the other aside, the discount rolls up and the label says it is
in; pressed again, the tile leaves and everything goes back -->
<button class="cmp" type="button" data-cmp aria-pressed="false">
<span class="cmp__body" aria-hidden="true"><span class="cmp__wash" data-wash></span><span class="cmp__light"></span></span>
<span class="sign" data-sign aria-hidden="true">
<svg viewBox="0 0 24 24">
<rect data-bar="a" x="2.6" y="6.5" width="9" height="11" rx="2.6"></rect>
<rect data-bar="b" x="12.4" y="6.5" width="9" height="11" rx="2.6"></rect>
</svg>
</span>
<span class="label"><span class="label__word" data-word>Add to bundle</span></span>
<span class="tray" data-tray aria-hidden="true">
<span class="tile tile--new" data-new><i></i></span>
<span class="tile tile--old"><i></i></span>
<span class="tray__count"><span data-count>5%</span></span>
</span>
</button>
<p class="sr" data-live aria-live="polite"></p>
<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.
15 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 “Add to bundle button” from Animorio and fit it into my siteThe button has aria-pressed and one function, set, that takes everything from one state to the other: the is-in class for edge, shadow and discount colour, the words, the sign, the tile.
They are two SVG rects: GSAP animates the x attribute of both towards the centre with elastic.out, the second 50 milliseconds later. JOIN says how much they overlap.
The new tile starts zero wide: first it widens to 28 pixels with its margin, and the room pushes the other tile by itself; 60 milliseconds later the tile scales from 0.3 to 1, rotates from minus 40 degrees to zero and drops 10 pixels, all on a spring.
The discount is STEP times the number of products in the bundle. Number and label leave upwards and the new version comes in from below when adding; the other way round when removing, so the direction says what happened.
| Name | File | Default | What it changes |
|---|---|---|---|
IDLE | script.js | Add to bundle | The label at rest. |
ADDED | script.js | In your bundle | The label when the product is in the bundle. |
OTHERS | script.js | 1 | How many products are already in the bundle. |
STEP | script.js | 5 | How many discount points each product is worth. |
ACCENT | script.js | #ff6a3d | The colour of the product coming in, the edge and the discount. |
SPRING | script.js | 0.8 | How long the spring of the tile coming in lasts, in seconds. |
JOIN | script.js | 0.6 | How much the sign’s two squares overlap: 0 not at all, 1 one on the other. |
HOLD | script.js | 2.4 | By itself: how many seconds it stays in the bundle before leaving. |
LOOP | script.js | true | Left alone, a pointer tries it by itself. |
For the product page of an online shop that sells sets to build: skincare, coffee, supplements, accessories. The button shows at once what is already in the bundle and how much discount has been reached, without opening the cart.
The same button: the pill takes at most the screen width minus the margins and the long label is cut with an ellipsis. On touch there is no shade following the pointer.
No springs and no spin: the tile fades in already in place, the squares move at once, discount and label change with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.1 KB; the libraries: GSAP 28 KB.
Tested on 14 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.