
The inchworm menu
Menus, Hover, Transitions
The small card of a perfume from an invented perfumery, Maison Odile, with a real photo of a green glass bottle with a silver atomizer in the sun, and under it the dark glass Add to bag button with the bag and its count. Pressed, a piece of the photo with the bottle comes away, rounds off and flies on a curve to the bag inside the button; the bag swallows it, the button swells on a spring, a reflection runs across the glass, the words turn into Added with a drawn check and the bag’s count rolls up. Then it goes back to rest.
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>
<!--
"Perfume add to bag 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 Add to bag button with the perfume bottle that flies into it</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 small product card of an invented perfumery, Maison Odile, with a real photo of a green glass bottle. Add to
bag: a little picture of the bottle leaves the photo, flies on a curve into the bag inside the button, the
button swells on a spring, the words become Added with a drawn check and the bag's count rolls up -->
<article class="card" data-card aria-label="Maison Odile, Verre de Jardin eau de parfum">
<figure class="card__pic" data-pic>
<span class="card__photo" data-photo>
<img class="card__img" src="boccetta.webp" width="1024" height="768" alt="A green glass perfume bottle with a silver atomizer on a wooden table, in the sun, with a garden out of focus behind">
</span>
<span class="card__glint" data-glint aria-hidden="true"></span>
<span class="card__chip">50 ml</span>
</figure>
<div class="card__info">
<div class="card__row">
<p class="card__house">Maison Odile</p>
<p class="card__price">$138</p>
</div>
<p class="card__name">Verre de Jardin <span class="card__kind">Eau de parfum</span></p>
<p class="card__notes">Fig leaf, vetiver, cut grass</p>
</div>
<div class="cta" data-cta>
<button class="cta__btn" type="button" data-btn data-autoclic aria-describedby="bag-live">
<span class="cta__body" data-body>
<span class="cta__skin">
<span class="cta__sheen" data-sheen aria-hidden="true"></span>
<span class="cta__words" aria-hidden="true">
<span class="cta__word cta__word--add" data-add>Add to bag</span>
<span class="cta__word cta__word--done" data-done>
<svg class="cta__check" viewBox="0 0 16 16"><path data-check pathLength="1" d="M3.2 8.6l3 3 6.6-7"/></svg>
<span>Added</span>
</span>
</span>
<span class="sr">Add to bag</span>
<span class="cta__well" data-well aria-hidden="true">
<svg class="cta__bag" data-bag viewBox="0 0 24 24">
<path class="cta__bag-handle" data-handle d="M8.6 9.2V7.4a3.4 3.4 0 0 1 6.8 0v1.8"/>
<path class="cta__bag-body" d="M5.4 8.6h13.2l-0.9 10.6a1.6 1.6 0 0 1-1.6 1.5H7.9a1.6 1.6 0 0 1-1.6-1.5z"/>
<path class="cta__bag-lip" data-lip d="M5.6 8.6h12.8"/>
</svg>
<span class="cta__count" data-count>
<span class="cta__digits" data-digits><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span>
</span>
</span>
</span>
</span>
</button>
</div>
</article>
<!-- the little picture of the bottle that flies into the bag -->
<span class="fly" data-fly aria-hidden="true"><span class="fly__img"></span><span class="fly__shine"></span></span>
<!-- the drawn pointer of the autopilot -->
<svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true">
<path d="M5 3.2l13.4 9.1-6 1.1 3.5 6.6-2.7 1.4-3.5-6.6-4.6 4z"/>
</svg>
<p class="sr" id="bag-live" aria-live="polite" data-live></p>
</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.
35 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 “Perfume add to bag button” from Animorio and fit it into my siteThe button is a body (.cta__body) that GSAP lifts, squashes and swells, and inside it a skin (.cta__skin) that gets the dark glass from CSS: two gradients, a thread of light at the top with an inset box-shadow, a grain made with feTurbulence in overlay and the green shadow. The glow that rises from the bag is an ::after with its opacity in a CSS variable, --glow, which GSAP animates.
The script works out where the bottle is inside the photo from object-fit: cover and object-position (scale, offset, and the bottle’s point in the image), and prepares the flying circle with the same image as its background, sized and offset in pixels like the photo: on the first frame it really is the piece of the photo, then it lifts with a longer shadow.
An object p goes from 0 to 1 and at each step the circle is placed on a cubic Bézier curve: it starts at the bottle, rises with the first control point, falls from above onto the bag’s well with the second. Start and end are read from the page at every step, so if the window changes size halfway through the flight the circle still lands in the well. Meanwhile it shrinks with power2.in, turns a few degrees halfway and its corner radius grows into a circle.
The ease is a true spring written as a function, a damped oscillator that settles by the end of the tween, with its strength taken from SPRING. On landing the bag squashes towards its bottom and the handles jump, the body swells and comes back, the two labels swap in a window with yPercent and the check draws itself with stroke-dashoffset on pathLength 1.
The bag’s count is a column of ten digits in a round window 18 pixels tall: to change number the column slides by yPercent, -10 for each digit, on the same spring, and the window swells for a moment. A reflection is a narrow gradient crossing the glass with xPercent, on hover and on landing.
| Name | File | Default | What it changes |
|---|---|---|---|
START_COUNT | script.js | 2 | How many items are already in the bag at the start, from 0 to 8. |
ACCENT | script.js | #3f9b78 | The one accent colour, the green of the glass: the bag’s count, the check, the glow. |
FLIGHT | script.js | 0.95 | The seconds of the bottle’s flight from the photo to the bag. |
ARC | script.js | 1 | How high the flight’s curve rises: 0 almost straight, 2 very high. |
SPRING | script.js | 1 | How springy the button is when the bottle lands: 0 none, 2 double. |
HOLD | script.js | 1.9 | The seconds it stays on Added before going back to rest. |
PAUSE | script.js | 1.3 | The seconds the autopilot waits between one round and the next. |
AUTO | script.js | true | The autopilot presses the button by itself until someone touches it. |
For the product page or card of an online store: a perfumery, a cosmetics or beauty shop, a candle, a wine, a piece of jewellery, anything with a beautiful photo. It says without opening anything that the item went into the bag and how many there are, and the flight joins the photo to the bag in a single gesture.
The same animation with adapted sizes: the card is almost as wide as the screen, the photo and the button get lower with the height (the button goes down to 50 pixels on short screens) and on the shortest ones the notes disappear. With a finger the button squashes and springs back; the hover reflection is only there with a pointer.
Nothing moves: the bottle does not fly, the labels Add to bag and Added swap with a fade, the check appears already drawn, the bag’s count changes in place with a fade and the green glow lights up and fades. The drawn pointer is not there.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.9 KB; the libraries: GSAP 28 KB.
Tested on 6 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.