
The elastic button
Buttons, Hover, Text
The Shuffle button of a playlist, on white, in the style of real product interface pieces: above it sits a small stack of four covers. Pressed, the covers lift, swap places on crossing arcs like a deck of cards and drop in a new order, while the two arrows of the icon cross; the cover that lands in front starts playing and the button becomes Playing with the equalizer bars.
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>
<!--
"Shuffle play 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 Shuffle play button that shuffles the covers</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">
<!-- one gesture: shuffle. Four album covers sit in a small stack above the button; pressing Shuffle lifts them,
deals them across each other on arcs like a deck of cards and drops them in a new order, and the cover
that lands on top starts playing -->
<div class="frame" data-inquadra>
<header class="head">
<span class="head__name">Late Drive</span>
<span class="head__meta">Playlist by Hollowtide · 24 tracks</span>
</header>
<div class="deck" data-deck aria-hidden="true">
<div class="cover cover--tide" data-cover data-title="Low Tide" data-track="3">
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
<circle class="sun" cx="66" cy="34" r="15"></circle>
<path class="wave" d="M0 62 Q12 56 25 62 T50 62 T75 62 T100 62"></path>
<path class="wave wave--b" d="M0 72 Q12 66 25 72 T50 72 T75 72 T100 72"></path>
<path class="wave wave--c" d="M0 82 Q12 76 25 82 T50 82 T75 82 T100 82"></path>
</svg>
<span class="cover__t">Low Tide</span>
</div>
<div class="cover cover--bus" data-cover data-title="Night Bus" data-track="7">
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
<path class="lane" d="M50 100 L46 40 M50 100 L54 40"></path>
<rect class="win" x="18" y="22" width="16" height="10" rx="2"></rect>
<rect class="win" x="40" y="22" width="16" height="10" rx="2"></rect>
<rect class="win" x="62" y="22" width="16" height="10" rx="2"></rect>
<path class="road" d="M0 70 H100"></path>
</svg>
<span class="cover__t">Night Bus</span>
</div>
<div class="cover cover--moon" data-cover data-title="Paper Moon" data-track="12">
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
<circle class="moon" cx="50" cy="42" r="22"></circle>
<circle class="moon-cut" cx="60" cy="36" r="20"></circle>
<path class="hill" d="M0 86 Q30 70 55 80 T100 74 V100 H0Z"></path>
</svg>
<span class="cover__t">Paper Moon</span>
</div>
<div class="cover cover--static" data-cover data-title="Static Bloom" data-track="18">
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
<g class="grid">
<path d="M10 20 H90 M10 32 H90 M10 44 H90 M10 56 H90 M10 68 H90 M10 80 H90"></path>
</g>
<rect class="block" x="30" y="38" width="40" height="24" rx="3"></rect>
</svg>
<span class="cover__t">Static Bloom</span>
</div>
</div>
<p class="now" aria-live="polite">
<span class="now__label">Up next</span>
<span class="now__title" data-now>Pick a starting track</span>
</p>
<button class="play" type="button" data-play>
<span class="play__bg" aria-hidden="true"></span>
<span class="ico" aria-hidden="true">
<svg class="ico__shuffle" viewBox="0 0 24 24">
<path class="sh sh--a" data-sh-a d="M3 7h3.6c2.2 0 3.6 1 4.8 2.8l2.2 4.4c1.2 1.8 2.6 2.8 4.8 2.8H21"></path>
<path class="sh sh--b" data-sh-b d="M3 17h3.6c2.2 0 3.6-1 4.8-2.8l2.2-4.4C14.8 8 16.2 7 18.4 7H21"></path>
<path class="sh-head" data-head-a d="M18.4 4.4 21 7l-2.6 2.6"></path>
<path class="sh-head" data-head-b d="M18.4 14.4 21 17l-2.6 2.6"></path>
</svg>
<span class="eq" data-eq>
<i></i><i></i><i></i><i></i>
</span>
</span>
<span class="labels" data-labels>
<span class="lab" data-lab="shuffle">Shuffle</span>
<span class="lab" data-lab="playing">Playing · Track <b data-track-n>7</b></span>
<span class="lab" data-lab="paused">Paused · Track <b data-track-p>7</b></span>
</span>
</button>
</div>
<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.
23 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 “Shuffle play button” from Animorio and fit it into my siteThe stack has four fixed places, written as offset, rotation and scale: in front straight, two at the sides tilted by eight degrees, one at the back and smaller. A list says which cover sits in which place; shuffling means changing the list and taking every cover to its new place.
Every cover goes from its old place to the new one with GSAP keyframes: three values of x, y, rotation and scale, with the middle point raised by ARC pixels and shifted sideways at random, so the paths cross. Halfway through the flight the z-index changes, so one cover passes over the other right when they cross.
The Shuffle icon is an SVG with two strokes that cross: on press the whole drawing goes from scaleY 1 to -1 and back, and the two arrows swap places passing over each other.
Four thin bars in scaleY, with the origin at the bottom: each one has a tween taking it to a random height in a random time and, when it ends, another one starts. On pause the tweens stop and the bars drop to four fixed low heights.
Shuffle, Playing and Paused sit in the same box in absolute position: the outgoing one rises and narrows on the wdth axis, the incoming one arrives narrow and widens with back.out, and the box width follows the one measured with offsetWidth, so the pill grows on the same spring.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #ff5a2e | The colour of the equalizer bars and of the square on the dark cover. |
SHUFFLE_TIME | script.js | 0.42 | The seconds of each pass, when the covers swap places. |
PASSES | script.js | 2 | How many times the covers swap before settling. |
ARC | script.js | 36 | How high the covers rise on the arc, in pixels. |
SPRING | script.js | 1.8 | How much covers and labels bounce when they settle. |
PAUSE | script.js | 1.8 | The seconds the autopilot shows each state. |
For the player of a music or podcast app, a playlist page, a record label’s showcase, the music of a venue or an event: wherever pressing shuffle should feel like a real gesture.
Stack and button sit in a box at most 92% of the screen wide; the covers are at most 138 pixels and never more than 31% of the height, so everything fits in the box. Under 400 pixels the button drops to 44 pixels. A tap does what a click does.
No arcs, bounces or rolls: the stack fades out and back in in the new order, the labels change with a fade, the bars stay still at four low heights 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 7.0 KB; the libraries: GSAP 28 KB.
Tested on 27 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.