Skip to content
animorio
IT
All components

Shuffle play button

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

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.

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

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.

23 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 “Shuffle play 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, the Late Drive playlist by Hollowtide, an invented artist, with twenty-four tracks; below, a stack of four covers drawn by us (a sunset over the sea, a bus at night, a paper moon, an orange square on black), one in front standing straight, two peeking out tilted at the sides and one at the back. Further down the Up next line and the black Shuffle pill with its two arrows. Pressed, the pill squashes and comes back with an elastic, the icon’s arrows cross, and the covers lift one after another: in two passes they swap places on crossing arcs, each with a small rotation and its shadow, like a shuffled deck, then drop into the new order with a bounce, the front one last and with a small pop. The cover that lands in front starts playing: the icon gives way to four orange bars going up and down, the label rolls to Playing · Track 7 widening on the wdth axis and the line above shows the album title. Pressed again, the button says Paused and the bars stop; another press shuffles again. On hover the stack fans out a little. A drawn pointer does it all by itself and starts again; it also really works with mouse, touch and keyboard.

How it works

Four places for the stack

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

Crossing arcs

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 crossing arrows

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.

The equalizer

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.

Labels on top of each other

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.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff5a2eThe colour of the equalizer bars and of the square on the dark cover.
SHUFFLE_TIMEscript.js0.42The seconds of each pass, when the covers swap places.
PASSESscript.js2How many times the covers swap before settling.
ARCscript.js36How high the covers rise on the arc, in pixels.
SPRINGscript.js1.8How much covers and labels bounce when they settle.
PAUSEscript.js1.8The seconds the autopilot shows each state.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The z-index has to change halfway through the flight, not at the end: changed at the end, the cover that should go in front stays behind the others for the whole arc and then jumps on top.
  • The new order is picked at random but with a different cover in front, otherwise sometimes the shuffle ends where it started and it looks as if nothing happened.
  • The stack is measured in proportion to the cover, which changes with the window height: on resize the places are computed again, but not in the middle of a shuffle.

Libraries

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.

Testing

Tested on 27 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