
The elastic button
Buttons, Hover, Text
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.
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> songs · <span class="roll" data-mins>7</span> 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>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
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 siteThe 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.
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.
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.
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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
TITOLO | script.js | "Night Ferry" | The song title. |
ARTISTA | script.js | "Halden Rooms" | Who plays it. |
DURATA | script.js | "3:42" | How long the song lasts: it is added to the queue minutes. |
VOLO | script.js | 0.62 | How long the cover’s flight to the button lasts, in seconds. |
ARCO | script.js | 46 | How many pixels the cover rises before dropping into the button. |
RIMBALZO | script.js | 1.4 | How much the queue lines bounce when the cover lands. |
ATTESA | script.js | 2.4 | How long it stays queued before the drawn pointer takes it out, in seconds. |
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.
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.
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.
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.
Tested on 30 October 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.