Skip to content
animorio
IT
All components

Expanding mini player

Players, HoverGSAP, CSS onlyMediumCompressed weight: Demo 10 KBGSAP 28 KBFreeDownload the zip

The mini player at the bottom of a music app, on white, in the style of product interface pieces: tapped, it opens into the full player. The cover grows out of the thumbnail, title and artist travel to their places and grow, the thin line becomes the progress bar and the buttons drop into their row, while the library behind steps back. Dragged down, the player folds back following the finger; on pause the cover shrinks, next slides the new cover in and rolls the title.

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>
<!--
  "Expanding mini player" 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 mini player that opens into the full player</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>
    <!-- the mini player at the bottom of a music app: tapped, it opens into the full player (the cover grows out of the
         thumbnail, title, progress and buttons travel to their places); dragged down, it folds back into the bar.
         Everything is one morph value from 0 (mini) to 1 (full), so a finger can scrub it halfway -->
    <section class="screen" data-card aria-label="Larkway music app">
      <div class="lib" data-lib>
        <header class="lib__head">
          <p class="lib__app">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 15.5c2.6-6.8 6.2-9.8 10.8-9 2.5.4 4.3 2.1 5.2 4.6"></path><path d="M4 15.5c3.4-2.6 6.8-3.4 10.2-2.5"></path><path d="M14.8 6.5l1.2 5"></path></svg>
            Larkway
          </p>
          <h1 class="lib__title">Library</h1>
          <div class="lib__tabs" aria-hidden="true"><span class="is-on">Songs</span><span>Albums</span><span>Artists</span></div>
        </header>
        <p class="lib__label">Recently played</p>
        <ul class="rows" data-rows></ul>
        <p class="lib__label">Made for you</p>
        <div class="tiles" aria-hidden="true">
          <span class="tile"><span class="tile__art art-1"></span><b>Daily Mix</b></span>
          <span class="tile"><span class="tile__art art-2"></span><b>Slow Mornings</b></span>
          <span class="tile"><span class="tile__art art-3"></span><b>Deep Focus</b></span>
        </div>
      </div>

      <div class="player" data-player role="button" tabindex="0" aria-label="Open player" aria-expanded="false">
        <span class="player__grip" data-o></span>
        <header class="player__top" data-o data-top>
          <button class="icon" type="button" data-close aria-label="Close player" tabindex="-1">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9.5l6 6 6-6"></path></svg>
          </button>
          <div class="player__from"><span>Playing from</span><b>Late hours</b></div>
          <button class="icon" type="button" aria-label="Queue" tabindex="-1">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h11M4 12h11M4 17h7"></path><path d="M17.5 14.5v5.5"></path><path d="M17.5 14.5l3-1"></path></svg>
          </button>
        </header>

        <div class="cover" data-cover><div class="cover__shade" data-shade></div></div>

        <div class="meta" data-meta>
          <p class="meta__title"><span data-title></span></p>
          <p class="meta__artist"><span data-artist></span></p>
        </div>
        <button class="icon add" type="button" data-o data-add aria-label="Add to library" tabindex="-1">
          <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8.6"></circle><path class="add__plus" d="M12 8.2v7.6M8.2 12h7.6"></path><path class="add__check" d="M8.4 12.3l2.5 2.5 4.9-5"></path></svg>
        </button>

        <div class="bar" data-bar><span class="bar__fill" data-fill></span><span class="bar__knob" data-knob></span></div>
        <p class="times" data-o data-times><span data-now>0:48</span><span data-left>-2:36</span></p>

        <button class="ctrl ctrl--prev" type="button" data-prev aria-label="Previous" tabindex="-1">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M18.5 6.2v11.6L10 12z"></path><path d="M10.5 6.2v11.6L2 12z" transform="translate(1.6 0)"></path></svg>
        </button>
        <button class="ctrl ctrl--play" type="button" data-play aria-label="Pause">
          <svg viewBox="0 0 24 24" aria-hidden="true">
            <g data-pause><rect x="6.6" y="5.4" width="3.7" height="13.2" rx="1.2"></rect><rect x="13.7" y="5.4" width="3.7" height="13.2" rx="1.2"></rect></g>
            <path data-tri d="M8 5.6v12.8c0 .8.9 1.3 1.6.8l9.4-6.4c.6-.4.6-1.2 0-1.6L9.6 4.8C8.9 4.3 8 4.8 8 5.6z"></path>
          </svg>
        </button>
        <button class="ctrl ctrl--next" type="button" data-next aria-label="Next">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 6.2v11.6L14 12z"></path><path d="M13.5 6.2v11.6L22 12z" transform="translate(-1.6 0)"></path></svg>
        </button>
      </div>
    </section>

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

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 “Expanding mini player” 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 very light grey background stands the white screen of Larkway, an invented music app: the library with the recently played songs, each with its gradient cover, the one playing written in coral with three small moving bars, and below the three covers of Made for you. At the bottom floats the mini player: the thumbnail, Low Tide Hours by Ilo Marsh, pause and next, and a thin coral line moving with the song. Tapped, the whole mini player becomes the full player in one spring movement: the box widens to the corners of the screen, the cover grows out of the thumbnail to the centre and takes a shadow of its own colour, title and artist drop below and grow, the line becomes the progress bar with its knob and the times, pause and next drop into the controls row and previous appears between them; at the top come the grip, the arrow to close, Playing from Late hours and the queue. Behind, the library steps back and dims a little. On pause the cover shrinks as if set down, and grows back with a spring when it plays again; the plus turns into a coral check; next brings the new cover in from the side while the old one steps back, and title and artist roll. Dragged down, the player follows the finger halfway between its two shapes, and on release it folds back into the bar or opens again depending on how far and how fast it was pulled. A drawn pointer does it all by itself and starts again; it also really works, with mouse, finger and keyboard.

How it works

One number, from zero to one

The player has no two layouts to swap: it has a value p going from 0, the mini player, to 1, the full player. For every piece the script works out the two boxes, the small and the large, and on every frame it writes position and size mixed by p; so opening is a tween of p and dragging is the finger changing it.

Sizes, in height too

The large box comes from the screen: margins, title, bar and controls have their height, and the cover takes the room left, never wider than the screen minus the margins. So in a low screen the cover shrinks instead of pushing the controls out; on resize both boxes are worked out again.

What only exists when open

The grip, the arrow, the times, the plus and the previous button have their own opacity starting at p equal to 0.55, with a small ten-pixel rise: they appear when the player is almost full, and while dragging they are the first to go.

Pause, next and the moving line

Pause shrinks the cover to 0.84 only as much as the player is open, because the scale is multiplied by p. Next puts the new cover on top of the old one and brings it in with expo.out, while the texts roll inside a mask. A GSAP ticker runs the song’s time and stretches the bar.

The finger decides

Dragging changes p in proportion to the pixels, with resistance past the edges; on release it looks at how far and how fast it was pulled, and the player goes to 0 or 1 on a back.out spring. Pointer capture only starts after six pixels, so a tap on a button stays a click on that button.

Values to change

NameFileDefaultWhat it changes
APPscript.jsLarkwayThe name of the music app.
ACCENTscript.js#f2542dThe accent colour: the playing song in the list, the mini player’s line and the mark.
OPEN_TIMEscript.js0.7The seconds the mini player takes to open into the full player.
CLOSE_TIMEscript.js0.55The seconds the full player takes to fold back into the bar.
BOUNCEscript.js0.8How far the spring overshoots and comes back on opening and closing (0 = none).
PAUSED_SIZEscript.js0.84How much the cover shrinks on pause (1 = stays the same).
PAUSEscript.js1The seconds the autopilot waits between one gesture and the next.

Try them in the Playground

When to use it

For a music or podcast app, a radio or audiobook player, any bar at the bottom that has to open into a full page and fold back with a finger.

On phones

The screen is sized on both width and height, with min() across pixels, vw and vh, so it fits whole even in a low box; in the full player the cover shrinks to leave room for the controls. A finger drags like the mouse and a tap does what a click does.

With reduced motion

No travelling pieces: the player goes from small to full and back with a fade, the new cover fades in, the texts change without rolling, the small bars stay still and the drawn pointer stays hidden.

Pitfalls

  • With pointer capture taken right at pointerdown, the click landed on the player and not on the pressed button: pause and next stopped answering. Capture now starts only when the gesture becomes a drag.
  • Animating the cover with scale distorted its rounded corners and its shadow: real width and height, written on every frame, keep radius and shadow right at every size.
  • A full player designed on width alone ran out at the bottom of a low box: the cover takes the room left after the controls, not the other way round.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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