Skip to content
animorio
IT
All components

Add to queue button

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

The Add to queue button of a music app, on black, with a single gesture: queueing a song. Pressed, a small copy of the cover lifts off the song’s row, leaving a dashed outline, hops, shrinks and flies into the button’s queue icon, whose lines move up to make room and bounce as it lands; the plus turns away, the button becomes Queued and the queue count rolls. A second tap takes it out: the cover rises back to its row.

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>
<!--
  "Add to queue 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 queue button with the cover flying 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>
    <!-- one gesture: add a song to the queue. A small copy of the cover lifts off the track row, shrinks and flies
         into the queue icon of the button, whose lines move up to make room; the queue count rolls, and a second
         press takes the song out again, the cover rising back to its row -->
    <section class="card" aria-label="Lowlight music player">
      <header class="head">
        <span class="head__title">Up next</span>
        <span class="head__count" aria-live="polite">
          <span class="roll" data-songs>2</span>&nbsp;songs&nbsp;·&nbsp;<span class="roll" data-mins>7</span>&nbsp;min
        </span>
      </header>

      <div class="track">
        <div class="cover" data-cover>
          <svg class="art" viewBox="0 0 44 44" aria-hidden="true">
            <defs>
              <linearGradient id="cielo" x1="0" y1="0" x2="0" y2="1">
                <stop offset="0" stop-color="#2a1f4d"></stop>
                <stop offset="0.62" stop-color="#7b5cc4"></stop>
                <stop offset="1" stop-color="#f0b48a"></stop>
              </linearGradient>
            </defs>
            <rect width="44" height="44" fill="url(#cielo)"></rect>
            <circle cx="29" cy="25" r="6.5" fill="#ffe2c4" opacity="0.92"></circle>
            <path d="M0 33 C8 30 14 31 22 32.5 S36 34 44 31 V44 H0Z" fill="#14102a"></path>
            <path d="M9 31.6 h9 l-1.4 2.2 h-6.2z" fill="#0b0918"></path>
            <rect x="12.6" y="27.2" width="0.9" height="4.4" fill="#0b0918"></rect>
            <path d="M5 36.5 h34" stroke="#ffe2c4" stroke-opacity="0.18" stroke-width="0.6"></path>
          </svg>
          <span class="cover__ghost" data-ghost aria-hidden="true"></span>
        </div>
        <div class="track__text">
          <span class="track__title" data-title>Night Ferry</span>
          <span class="track__artist" data-artist>Halden Rooms</span>
        </div>
        <span class="track__time" data-time>3:42</span>
      </div>

      <div class="actions">
        <button class="btn" type="button" data-btn aria-pressed="false">
          <span class="btn__bg" data-bg aria-hidden="true"><span class="btn__dark" data-dark></span></span>
          <svg class="icon" viewBox="0 0 24 24" aria-hidden="true" data-icon>
            <g data-lines>
              <path class="icon__line" d="M3.5 6.5h11"></path>
              <path class="icon__line" d="M3.5 11.5h11"></path>
            </g>
            <g data-plus><path class="icon__line" d="M18.5 13.5v7M15 17h7"></path></g>
            <g data-slot>
              <rect class="icon__mini" data-mini x="3.5" y="14.6" width="5" height="5" rx="1.3"></rect>
              <path class="icon__line icon__line--short" data-short d="M10.8 17.1h4.2"></path>
            </g>
          </svg>
          <span class="btn__labels" data-labels>
            <span class="btn__label" data-label-a>Add to queue</span>
            <span class="btn__label" data-label-b>Queued</span>
          </span>
        </button>
      </div>
    </section>

    <div class="fly" data-fly aria-hidden="true"></div>

    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.2 18.6 13l-6.1.9 3.6 6.6-2.6 1.4-3.6-6.6L5.3 19.6z"></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.

26 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 “Add to queue 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 a black background sits the card of a made-up music app, Lowlight: at the top Up next with the queue count, 2 songs · 7 min, below it the row of a song, Night Ferry by Halden Rooms, with its drawn cover (a lilac sunset over the sea with a small ferry) and its length, and at the bottom right the white Add to queue pill with the queue icon: two lines and a plus. Hovering turns the plus a quarter and the lines lean in. Pressed, the button gives and springs back, the row’s cover dims leaving a dashed outline and a copy of it lifts a few pixels, tilting, then hops along an arc, shrinks and drops into the icon. As it arrives the plus turns away and the two lines move up to make room; on landing the copy becomes a small lilac square with its short line, the lines bounce, the button swells slightly and turns dark reading Queued, and at the top the count rolls to 3 songs · 11 min. The cover lights up again in its row. A second tap takes it out: the little square vanishes, the cover rises back to the row along an arc and settles with a small knock, the plus returns and the count rolls back. A drawn pointer does it all by itself and steps aside at the first touch.

How it works

A copy of the drawing

The cover is an SVG: on start a copy is cloned into an absolute div above everything, with the gradient renamed because two identical ids in the page clash. The copy is what flies; the row stays where it is.

Positions read at the moment

The start is the cover’s rectangle, the end is the little square’s place in the icon, worked out from the icon itself because the hidden square is scaled down: both relative to the stage and read on every flight, so they hold at any window size.

The arc

A quadratic curve between start and end, with the control point halfway and ARCO pixels higher: a single tween from zero to one with power2.inOut works out position, scale, tilt, corners and shadow, which shortens as the copy comes down.

Making room

The plus turns 45 degrees and vanishes halfway through the flight, the lines move up almost two units just before arrival; on landing the little square appears with back.out and the short line from the left, and the lines come back down on an elastic.

The rolling count

Each number is a one-line window with a soft mask: the old one leaves upwards in just over two tenths, the new one comes in from below right after with back.out, so the two are never readable together. Taking it out, the direction is reversed.

Values to change

NameFileDefaultWhat it changes
TITOLOscript.js"Night Ferry"The song title.
ARTISTAscript.js"Halden Rooms"Who plays it.
DURATAscript.js"3:42"How long the song lasts: it is added to the queue minutes.
VOLOscript.js0.62How long the cover’s flight to the button lasts, in seconds.
ARCOscript.js46How many pixels the cover rises before dropping into the button.
RIMBALZOscript.js1.4How much the queue lines bounce when the cover lands.
ATTESAscript.js2.4How long it stays queued before the drawn pointer takes it out, in seconds.

Try them in the Playground

When to use it

In the track list of a music or podcast app, on an album page, in a web player: anywhere you put something in a queue and want to see where it went.

On phones

The same card at the width of the screen, with the same animations: a tap on the button starts the flight, and a second tap brings it back.

With reduced motion

No flight or bounces: on tap the plus fades, the little square fades in, the button turns dark and the count changes with a fade. The drawn pointer does not run.

Pitfalls

  • Cloning the cover SVG also clones the gradient id: two identical ids in the page and the browser uses the first, which may go with it. The clone gets its own id.
  • The hidden little square is scaled down: measuring it with getBoundingClientRect gives a smaller, shifted target. The place is worked out from the icon.
  • The rolling count changes width between 7 and 11: the window has to be held at the wider of the two numbers until the roll is over, or the text next to it jumps.
  • A second click during the flight would spoil it all: the button ignores taps until its timeline has finished.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.1 KB; the libraries: GSAP 28 KB.

Testing

Tested on 30 October 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