
Falling tools
Physics, Hover
The product card of a made-up sweet shop, Perle & Fig: a sea-salt caramel wrapped in cellophane on a pale tile, and next to it the paper bag already half full. Add to cart unwraps it: the two cellophane ends snap open and flutter away, the bare caramel arcs into the bag, bounces on the pile with real gravity, the bag gives on the impact, folds shut and the bag count rolls. Hand-written physics. Minimal style, a single accent.
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>
<!--
"Candy add to cart" 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>Candy add to cart</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- The product card of a made-up sweet shop, Perle & Fig. Add to cart unwraps the caramel: the two twisted ends
snap open and flutter away, the bare caramel flies in an arc into the paper bag and bounces on the pile with
real gravity, the bag squashes, folds shut and the count in the corner rolls. -->
<main class="stage">
<article class="shop" data-shop aria-label="Sea-salt caramel, Perle and Fig">
<header class="shop__head">
<p class="brand">Perle & Fig <span>Confectioners</span></p>
<p class="bagcount" aria-live="polite">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 5.5h9l-.8 8h-7.4z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/><path d="M6 5.5V4.6a2 2 0 0 1 4 0v.9" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
<span class="bagcount__label">Bag</span>
<span class="count" data-count><span class="count__roll" data-roll><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>
</p>
</header>
<div class="scene" data-scene>
<div class="tile" data-tile>
<span class="tile__glow" aria-hidden="true"></span>
<span class="tile__shadow" data-shadow aria-hidden="true"></span>
</div>
<div class="bag" data-bag aria-hidden="true">
<span class="bag__shadow" data-bag-shadow></span>
<div class="bag__body" data-bag-body>
<svg class="bag__back" data-squash viewBox="0 0 100 120" preserveAspectRatio="none">
<path d="M8 6h84l-2 112H10z" fill="var(--kraft-dark)"/>
<path d="M8 6h84l-1 10H9z" fill="var(--kraft-deep)"/>
</svg>
<div class="bag__layer bag__layer--pile" data-squash>
<span class="pile pile--a"></span>
<span class="pile pile--b"></span>
<span class="pile pile--c"></span>
</div>
<div class="bag__layer bag__layer--front" data-squash>
<svg class="bag__front" viewBox="0 0 100 120" preserveAspectRatio="none">
<path d="M4 18h92l-3 102H7z" fill="var(--kraft)"/>
<path d="M4 18h92v3.2H4z" fill="var(--kraft-light)"/>
<path d="M17 21 15 118" stroke="var(--kraft-crease)" stroke-width=".7" fill="none"/>
<path d="M83 21l2 97" stroke="var(--kraft-crease)" stroke-width=".7" fill="none"/>
<path d="M7 104h86" stroke="var(--kraft-crease)" stroke-width=".5" fill="none" opacity=".7"/>
</svg>
<span class="bag__label"><span>P&F</span></span>
</div>
<div class="bag__layer bag__layer--fold" data-squash>
<span class="bag__fold" data-fold></span>
</div>
</div>
</div>
<div class="candy" data-candy aria-hidden="true">
<svg viewBox="0 0 60 40">
<defs>
<radialGradient id="caramel" cx="38%" cy="32%" r="75%">
<stop offset="0" stop-color="var(--candy-light)"/>
<stop offset=".55" stop-color="var(--accent)"/>
<stop offset="1" stop-color="var(--candy-deep)"/>
</radialGradient>
</defs>
<ellipse cx="30" cy="20" rx="22" ry="15.5" fill="url(#caramel)"/>
<path d="M14 14c5-6 18-8 27-3" stroke="#fff" stroke-opacity=".55" stroke-width="2.2" fill="none" stroke-linecap="round"/>
<ellipse cx="30" cy="20" rx="22" ry="15.5" fill="none" stroke="var(--candy-deep)" stroke-opacity=".35" stroke-width=".8"/>
<g class="candy__cello" data-cello>
<ellipse cx="30" cy="20" rx="23.5" ry="17" fill="#fff" fill-opacity=".14" stroke="#fff" stroke-opacity=".75" stroke-width=".7"/>
<path d="M20 7.5c3-1 7-1.2 10-1" stroke="#fff" stroke-opacity=".9" stroke-width="1.1" fill="none" stroke-linecap="round"/>
</g>
</svg>
</div>
<div class="wrap wrap--l" data-wrap aria-hidden="true">
<svg viewBox="0 0 30 40"><path d="M29 15 3 3l4 17-4 17 26-12z" fill="#fff" fill-opacity=".5" stroke="#fff" stroke-width=".8" stroke-linejoin="round"/><path d="M28 17 8 9M28 20H6M28 23 8 31" stroke="var(--cello-line)" stroke-width=".6" fill="none"/></svg>
</div>
<div class="wrap wrap--r" data-wrap aria-hidden="true">
<svg viewBox="0 0 30 40"><path d="M1 15l26-12-4 17 4 17L1 25z" fill="#fff" fill-opacity=".5" stroke="#fff" stroke-width=".8" stroke-linejoin="round"/><path d="M2 17l20-8M2 20h22M2 23l20 8" stroke="var(--cello-line)" stroke-width=".6" fill="none"/></svg>
</div>
</div>
<div class="info">
<div>
<h1 class="info__name">Sea-salt caramel</h1>
<p class="info__meta">Hand-pulled, butter & flaked salt</p>
</div>
<p class="info__price">$1.20<span> each</span></p>
</div>
<button class="pill" type="button" data-add data-autoclic>
<span class="pill__fill" data-fill aria-hidden="true"></span>
<span class="pill__label" data-label-add>Add to cart</span>
<span class="pill__label pill__label--done" data-label-done aria-hidden="true">
<svg viewBox="0 0 16 16"><path d="M3.5 8.4 6.6 11.3 12.6 4.9" pathLength="1" data-tick/></svg>
Added
</span>
</button>
</article>
</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.
43 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Candy add to cart” from Animorio and fit it into my siteThe caramel is an element above the scene, moved with x and y. On click the ballistic throw that takes it to its spot in the bag in FLIGHT seconds is worked out: with gravity g, vx = dx / T and vy = (dy − g·T²/2) / T. From there it is just integration in the GSAP ticker, with the real time between frames: vy grows by g·dt, the position by v·dt.
When it reaches the pile the vertical speed flips sign and shrinks by BOUNCE; the horizontal one drops a lot, and a small spring keeps it in the middle of the mouth. Under a certain speed it stops, and its rotation settles on the nearest side with an elastic ease.
The bag is made of layers: the back, the pile, the caramel, the front and the fold. The container itself is never transformed (otherwise the caramel could not sit between the layers): each layer squashes on its own from the bottom, on a damped spring that every impact kicks.
The two ends are separate elements attached to the caramel’s sides. On click they break off with a speed outwards and upwards, then fall with little gravity, a lot of drag and a push that swings left and right: so they flutter instead of dropping like stones, and fade away.
The pill’s two labels sit out of the flow, centred over the whole pill, so the hidden one never widens anything. The number is a column of digits inside the circle, which moves up by one height for each caramel with back.out.
| Name | File | Default | What it changes |
|---|---|---|---|
GRAVITY | script.js | 2600 | How strong gravity is, in pixels per second squared. |
FLIGHT | script.js | 0.46 | How long the arc into the bag lasts, in seconds: longer means higher. |
BOUNCE | script.js | 0.42 | How much the caramel bounces on the pile. |
SPIN | script.js | 520 | How fast the caramel turns in the air, in degrees per second. |
SQUASH | script.js | 0.11 | How much the bag gives on the impact. |
FLUTTER | script.js | 1 | How much the cellophane ends flutter as they fall (0 straight down). |
HOLD | script.js | 1.3 | How long the bag stays shut before it opens again, in seconds. |
AUTO_PILOT | script.js | 2.6 | After how many still seconds the card adds a caramel by itself (0 never). |
--accent | style.css | #c9592b | The single accent colour: the caramel. |
On the product page of a sweet shop, a confectioner, a pastry shop, a coffee roaster or any shop selling small things by the piece: wherever adding to cart should give a little extra pleasure.
The card is sized on the width and the scene on the height too (vh); the caramel takes its size from the tile. Same throw, same physics, by touch.
No flight and no bounces: the caramel fades out, the pill fades to Added with the check already drawn, the bag closes at once, the number changes without rolling and the new caramel fades in.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.0 KB; the libraries: GSAP 28 KB.
Tested on 28 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.
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.