Skip to content
animorio
IT
All components

The Save to collection button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 10 KBGSAP 28 KBFreeDownload the zip

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».

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>
<!--
  "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>

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.

34 values to change

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 “The Save to collection button” 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 white there is the card of a picture, «Amber dropper, label study» by Studio Orra, made up: a real photo of an amber glass dropper bottle with a blank kraft paper label, on the white studio sweep warmed slightly by a sand-coloured grade, and below the title and «2,418 saves». At the top right of the image sits the Save pill, white and frosted, 60 pixels tall: on hover it rises a pixel and a half, its shadow stretches, the bookmark hops and the picture darkens slightly; pressed, it squashes and the shadow tightens. On click the bookmark fills red from the bottom, squashes and springs back with five short rays escaping, and a small popover opens from the button, «Save to collection», with three rows: Moodboard 24, Packaging 11, Type 7, each with its three-thumbnail cover. Pick Packaging and the row dips for a moment, the bottle’s frame flashes on the picture and its crop lifts off, flies in an arc while shrinking and takes the first place in the cover; the other thumbnails move one place along and the last one disappears, the count rolls to 12 and the red check draws itself. Then the popover closes back into the button, which swallows it with a small squash: the black spreads from the bookmark, the label rolls to «Saved to Packaging» and the saves under the picture go to 2,419. Pressed again, the black goes back into the bookmark, which empties, and the button is Save again. The drawn pointer does it all by itself and stops at the first touch.

How it works

The bookmark that fills

Inside 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 born from the button

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 flying crop

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 cover that makes room

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.

Rolling digits and labels

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.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#f0443aThe colour of the filled bookmark, the rays and the check in the collection.
PICKscript.jsPackagingThe collection the autopilot picks.
OPENscript.js0.5The seconds the popover takes to open from the button, on its spring.
FLYscript.js0.72The seconds of the thumbnail’s flight from the picture to the collection.
ARCscript.js56How many pixels the flight’s arc rises above the straight line.
BOUNCEscript.js1.7How much the bookmark, the popover and the labels bounce.
HOLDscript.js2.2The seconds the autopilot shows «Saved to …».

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The hidden count was moved down with translateY(100%) in the CSS: GSAP reads it as pixels and adds it to yPercent, so the new digit stayed outside the row. Both lines are always reset with y: 0 and yPercent.
  • Inserting the new thumbnail as the first child changes the nth-child rules of all the others, which would jump before moving: they must be pinned inline in place before the insertion.
  • With back.out the button’s width, when shrinking from «Saved to Packaging» to «Save», dips below the right size and cuts the last letter for a moment: the spring applies only when it grows.
  • With object-fit: cover the photo is cut differently at every card size (on a phone the card is shorter): the crop that flies cannot be fixed in percentages of the card, it is worked out each time from the photo’s real box, its natural size and the cover scale.

Libraries

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.

Testing

Tested on 5 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 components