
The elastic button
Buttons, Hover, Text
A picture card in an inspiration app, on white, in the style of clean product interface pieces: over the image sits the frosted Save pill. Pressed, the bookmark fills red on a spring and a small popover with three collections opens from the button; pick Packaging and a crop of the picture lifts off, flies in an arc into the collection’s cover, the other thumbnails make room, the count rolls from 11 to 12 and the popover closes back into the button, which turns black: «Saved to Packaging».
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>
<!--
"The Save to collection 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 Save to collection button</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>
<!-- one gesture: save the picture. The bookmark fills, a small popover opens from the button with three
collections; the chosen one receives a thumbnail lifted from the picture, its count rolls on,
and the popover closes back into the button, which now says where the picture went -->
<article class="pin" data-inquadra aria-label="Amber dropper, label study">
<div class="pin__media" data-media>
<div class="pin__img">
<img class="art" src="contagocce.webp" width="760" height="524" alt="An amber glass dropper bottle with a blank kraft label, on white" data-art>
<span class="pin__shade" data-shade></span>
<span class="pin__flash" data-flash></span>
</div>
<button class="save" type="button" data-save aria-haspopup="menu" aria-expanded="false" aria-controls="boards">
<span class="save__glass" data-glass aria-hidden="true"></span>
<span class="save__ink" data-ink aria-hidden="true"></span>
<span class="save__ico" data-ico aria-hidden="true">
<svg viewBox="0 0 24 24">
<defs><clipPath id="bm-clip"><path d="M7.2 3.8h9.6a1.4 1.4 0 0 1 1.4 1.4v15.1l-6.2-4.3-6.2 4.3V5.2a1.4 1.4 0 0 1 1.4-1.4Z"></path></clipPath></defs>
<g clip-path="url(#bm-clip)"><rect class="bm-fill" data-fill x="3" y="22" width="18" height="22"></rect></g>
<path class="bm-line" d="M7.2 3.8h9.6a1.4 1.4 0 0 1 1.4 1.4v15.1l-6.2-4.3-6.2 4.3V5.2a1.4 1.4 0 0 1 1.4-1.4Z"></path>
<g class="bm-burst" data-burst><path d="M12 -1.4v-2.4"></path><path d="M21.4 3.2l1.8-1.6"></path><path d="M2.6 3.2l-1.8-1.6"></path><path d="M23.4 11.6h2.4"></path><path d="M0.6 11.6h-2.4"></path></g>
</svg>
</span>
<span class="labels" data-labels>
<span class="label" data-l="save">Save</span>
<span class="label" data-l="saved">Saved to <b data-saved-name>Packaging</b></span>
</span>
</button>
<div class="pop" id="boards" role="menu" data-pop aria-label="Save to collection">
<div class="pop__head" data-head>
<span>Save to collection</span>
<span class="pop__new" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M8 3.5v9M3.5 8h9"></path></svg></span>
</div>
<button class="row" type="button" role="menuitem" data-row data-name="Moodboard">
<span class="cover" data-cover>
<span class="tile t-terra"></span>
<span class="tile t-sand"></span>
<span class="tile t-olive"></span>
</span>
<span class="row__name">Moodboard</span>
<span class="row__count" data-count><span data-ca>24</span><span data-cb>25</span></span>
<svg class="row__check" viewBox="0 0 16 16" aria-hidden="true"><path data-check d="M3.6 8.4l2.8 2.8 6-6.4"></path></svg>
</button>
<button class="row" type="button" role="menuitem" data-row data-name="Packaging">
<span class="cover" data-cover>
<span class="tile t-box"></span>
<span class="tile t-label"></span>
<span class="tile t-kraft"></span>
</span>
<span class="row__name">Packaging</span>
<span class="row__count" data-count><span data-ca>11</span><span data-cb>12</span></span>
<svg class="row__check" viewBox="0 0 16 16" aria-hidden="true"><path data-check d="M3.6 8.4l2.8 2.8 6-6.4"></path></svg>
</button>
<button class="row" type="button" role="menuitem" data-row data-name="Type">
<span class="cover" data-cover>
<span class="tile t-aa">Aa</span>
<span class="tile t-g">g</span>
<span class="tile t-r">R</span>
</span>
<span class="row__name">Type</span>
<span class="row__count" data-count><span data-ca>7</span><span data-cb>8</span></span>
<svg class="row__check" viewBox="0 0 16 16" aria-hidden="true"><path data-check d="M3.6 8.4l2.8 2.8 6-6.4"></path></svg>
</button>
</div>
</div>
<div class="pin__cap">
<p class="pin__title">Amber dropper, label study</p>
<p class="pin__meta">Studio Orra · <span class="roll" data-saves><span data-sa>2,418</span><span data-sb>2,419</span></span> saves</p>
</div>
<p class="sr" aria-live="polite" data-live></p>
</article>
<!-- the thumbnail lifted from the picture, flying into the collection -->
<span class="flyer" data-flyer aria-hidden="true">
<span class="snip"></span>
</span>
<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.
34 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 “The Save to collection button” from Animorio and fit it into my siteInside the icon a red rectangle is clipped by a bookmark-shaped clipPath: it rises by changing its y attribute, while the icon goes from scaleY 0.78 to 1 with elastic.out and five short strokes escape from the centre with svgOrigin and fade.
The popover’s transformOrigin is the centre of the button, computed with offsetLeft and offsetTop in the same container: it opens from scale 0.32 with back.out and closes to scale 0.16 towards the same point, while the button squashes by 0.06 and springs back.
The bottle’s crop is written in pixels of the photo file (CROP): from the photo’s getBoundingClientRect and the object-fit: cover scale you get where it sits on screen, and the thumbnail is a span with the same photo as its background, with background-size and background-position worked out for that crop. It flies along a quadratic Bézier curve to the first slot of the cover, measured again on every frame, changing width, height and radius together.
The three thumbnails are absolutely positioned: before inserting the new one they are pinned inline where they are (the nth-child rules would move them), then each goes to the next slot with back.out and the last one shrinks and leaves.
The count, the saves and the button label each have two stacked lines in a container with hidden overflow: the old one leaves upwards, the new one comes from below narrow on the wdth axis and widens, and the button’s width follows on a spring only when it grows.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #f0443a | The colour of the filled bookmark, the rays and the check in the collection. |
PICK | script.js | Packaging | The collection the autopilot picks. |
OPEN | script.js | 0.5 | The seconds the popover takes to open from the button, on its spring. |
FLY | script.js | 0.72 | The seconds of the thumbnail’s flight from the picture to the collection. |
ARC | script.js | 56 | How many pixels the flight’s arc rises above the straight line. |
BOUNCE | script.js | 1.7 | How much the bookmark, the popover and the labels bounce. |
HOLD | script.js | 2.2 | The seconds the autopilot shows «Saved to …». |
For an inspiration app or site, an image board, a studio portfolio with visitors’ collections, a recipe or interiors blog, a shop’s wishlist: anywhere something is saved into a collection chosen on the spot.
The card is 92 per cent of the screen wide up to 320 pixels and the image at most 52 per cent of the height; the popover stays inside the card, 236 pixels wide or as wide as the card minus 24. A tap does what a click does, and the hover isn’t needed on a phone.
No flight, springs or rays: the popover fades in and out, the bookmark fills without hopping, the thumbnail appears in its place in the cover, digits and labels change without rolling and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 10 KB; the libraries: GSAP 28 KB.
Tested on 5 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.