Skip to content
animorio
IT
All components

Save to library button

Buttons, Hover, SVGGSAP, Canvas, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The album card of an invented music app, Murmur, in a dark studio with a warm light and grain, like a Dribbble shot: the sleeve is a real photograph of the sea at sunset, with the sun just above the horizon and a wave breaking against the light, with the record half out of it, turning slowly. Press Save to library and a copy of the sleeve lifts off, shrinks and slides on an arc into the little stack of the library, the albums under it step down and sink by a pixel, the count rolls from 128 to 129 albums, the plus bends into a check and a wave of warm light runs across the grooves of the vinyl.

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>
<!--
  "Save to library 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 library button with the album sliding into the stack</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">
    <!-- the album page of a music app (Murmur): the sleeve with the record half out of it, and the Save to library
         button. Pressed, a copy of the sleeve slides on an arc into the little stack of the library, the albums under
         it sink, the count rolls by one, the plus becomes a check and a ring of light runs across the record. Pressed
         again, the album leaves the library -->
    <div class="fit" data-fit>
      <section class="card" data-card aria-label="Low Tide Hymns, album">
        <span class="card__light" data-light aria-hidden="true"></span>
        <span class="card__edge" aria-hidden="true"></span>

        <div class="art" aria-hidden="true">
          <div class="vinyl" data-vinyl>
            <div class="vinyl__disc" data-disc>
              <span class="vinyl__grooves"></span>
              <canvas class="vinyl__label" data-label></canvas>
            </div>
            <span class="vinyl__sheen"></span>
            <span class="vinyl__wave" data-wave></span>
            <span class="vinyl__hole"></span>
          </div>
          <div class="sleeve" data-sleeve>
            <canvas class="sleeve__photo" data-cover></canvas>
            <span class="sleeve__paper"></span>
          </div>
        </div>

        <div class="info">
          <p class="eyebrow"><svg class="eyebrow__mark" viewBox="0 0 16 16" aria-hidden="true"><path d="M2 9.5c1.6 0 1.6-3 3.2-3s1.6 5 3.2 5 1.6-7 3.2-7 1.6 5 2.4 5"/></svg>Murmur<span class="eyebrow__sep">·</span>New album</p>
          <h1 class="title" data-album>Low Tide Hymns</h1>
          <p class="meta"><span data-artist>Ines Varga</span> · 2026 · 9 songs, 38 min</p>

          <button class="save" type="button" data-btn data-autoclic aria-pressed="false">
            <span class="save__body" data-body>
              <span class="save__fill" data-fill aria-hidden="true"></span>
              <span class="save__light" aria-hidden="true"><span class="save__light-spot" data-spot></span></span>
              <span class="save__sweep" aria-hidden="true"><span class="save__sweep-band" data-sweep></span></span>
              <span class="save__edge" aria-hidden="true"></span>
              <span class="save__row">
                <span class="save__icon" data-icon aria-hidden="true">
                  <svg viewBox="0 0 24 24"><path data-mark d="M7 12 L17 12 M12 7 L12 17"/></svg>
                </span>
                <span class="save__words" aria-hidden="true">
                  <span class="save__word" data-word>Save to library</span>
                  <span class="save__word" data-word>Saved to library</span>
                </span>
                <span class="save__sr" data-label-text>Save to library</span>
              </span>
            </span>
          </button>

          <div class="lib">
            <div class="pile" data-pile aria-hidden="true"></div>
            <div class="lib__text">
              <span class="lib__name">Your library</span>
              <span class="lib__count"><span class="odo" data-odo></span><span class="lib__unit">albums</span></span>
            </div>
          </div>
        </div>

        <div class="ghost" data-ghost aria-hidden="true"><canvas data-ghost-canvas></canvas><span class="ghost__shine" data-ghost-shine></span></div>
      </section>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
    <!-- the photographs of the sleeves, drawn on the canvases by script.js -->
    <div hidden>
      <img data-photo src="marea.webp" alt="">
      <img data-photo src="viola.webp" alt="">
      <img data-photo src="prato.webp" alt="">
      <img data-photo src="foschia.webp" alt="">
      <img data-photo src="brace.webp" alt="">
    </div>
  </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.

29 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 “Save to library 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

In a dark studio, with a warm light behind and a very fine grain, the album card of Murmur, an invented music app, stands alone: on the left the sleeve, a real photograph of the sea at sunset with the sun low on the horizon, a wave breaking against the light, the sun’s reflection on the wet sand, a lens flare and a light film grain, and half out of the sleeve the vinyl with its grooves, turning slowly under a light that stays still. On the right Low Tide Hymns, Ines Varga, and the Save to library button with its orange disc and the plus; below, the little stack of the library with the covers of other albums, real photographs as well (a purple sky over the sea, a golden meadow, a pink and blue calm, a red sunset), one on top of the other, and the count 128 albums. Pressed, the button sinks, a copy of the sleeve lifts with a flash, shrinks and slides on an arc into the stack, settling with a spring; the albums under it step down and sink by a pixel, the count rolls to 129, the plus bends into a check, the warm light fills the button, a reflection crosses it, and on the vinyl, which comes out a little more and speeds up, a ring of light runs through the grooves from the centre to the edge. Pressed again, the album lifts out of the stack and the count goes back to 128.

How it works

The photographs on the sleeves

The covers are real CC0 photographs, in webp in the demo’s folder and loaded with hidden img tags so the load event waits for them. Each one is drawn once on a canvas, cut square around its point (the sun for the big sleeve); over it a warm vignette, a dark veil at the top so the name reads and the film grain, a noise canvas made once pixel by pixel and laid on in overlay mode, then the type in the variable typeface.

One card drawn at one size

The card has two shapes, wide (680 by 316) and narrow (320 by 410), and script.js scales it to fit the page; the box around it takes the scaled size. So every pixel in the CSS stays true and the flight is worked out in the card’s own pixels, dividing getBoundingClientRect by the scale.

The flight on an arc

A single value t from 0 to 1 with power3.inOut drives a quadratic Bézier curve between the centre of the sleeve and the centre of the stack, with the control point above; the scale falls faster at the start (t to the power 0.75) and the rotation follows a sine, so the cover tilts halfway and arrives straight.

The stack making room

Each album in the stack has a step (6 pixels up, 10% smaller, a shade on top that gets darker). On arrival each one moves to the next step with two keyframes: first a pixel lower, then up with a spring; the fourth fades away, and the new cover settles from 3 pixels higher with an elastic.

The count and the check

Every digit is a column of two rounds of 0 to 9 behind a mask one line high: it always rolls forward and at the end jumps unseen back to the first round; the digits start from the right, staggered. The plus and the check are the same SVG path with the same number of points, and GSAP tweens its d attribute.

The wave on the vinyl

Over the grooves sits a radial gradient with a bright ring at radius --r, in screen mode and masked by the grooves themselves; GSAP carries --r from 16% to 104% while the vinyl comes out 12 pixels on a spring and its turn speeds up with timeScale and then slows. The light on the vinyl, a conic-gradient, does not turn with it.

Values to change

NameFileDefaultWhat it changes
ALBUMscript.jsLow Tide HymnsThe album title, on the card and on the sleeve.
ARTISTscript.jsInes VargaThe artist, on the card and on the sleeve.
COUNTscript.js128How many albums are in the library before saving.
FLIGHTscript.js0.85Seconds the sleeve takes to slide into the stack.
SPRINGscript.js1How springy the moves are: 0.4 calm, 2 very bouncy.
SPINscript.js7Seconds for one turn of the vinyl.
HOLDscript.js3.2Seconds the album stays saved before the loop takes it out again.
AUTOscript.jstrueGoes round by itself until someone touches it.
--amberstyle.css#ffa45eThe accent: the button disc, the saved light, the wave on the vinyl.
--pagestyle.css#09090bThe studio around the card.

Try them in the Playground

When to use it

For a music app or site, an online record shop, a label, a podcast or audiobook platform, and for any “save to favourites” in a catalogue with covers (books, films, games): it shows where the saved thing goes and how many there are.

On phones

On the phone the card switches to its narrow shape: the sleeve with the vinyl on top, the title, the button and the stack below; it scales to fit the screen. There is no hover, so the light under the finger turns on at the touch, the rest is the same.

With reduced motion

Nothing moves: the vinyl stands still, the cover does not fly but fades in on top of the stack, the other albums take their step at once, the count changes in place, the plus becomes a check without turning and the wave is only a glow that comes and goes.

Pitfalls

  • With the card scaled by a transform, getBoundingClientRect is in screen pixels, and the cover flew off course on the phone: every measure is divided by the scale and the flight is worked out in the card’s pixels.
  • Scaled from the top left corner, the copy turned around that corner: the origin is the centre and the curve drives the centre, then x and y come from taking off half a sleeve.
  • A plus and a check with different numbers of points jumped instead of bending: both have two segments, four pairs of numbers, and GSAP tweens the string.
  • The type on the sleeve came out in the system font because the canvas was painted before Mona Sans arrived: it is painted again when document.fonts.ready resolves.
  • The loop started from when the script was read and the poster fell at different moments: it starts from the page’s load event.
  • The grain was written by reading the photo’s pixels with getImageData, but where the page and the photo come from different origins the canvas is tainted and the browser throws: the noise lives on its own canvas, made once, and is laid over in overlay mode without reading the photo.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 12 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