
The layered button
Buttons, Hover, Physics
The bottom navigation bar, the tab bar, of a music app, on black: the marker of the chosen tab is the cover of the song playing, a small rounded square that slides from tab to tab on a spring and tilts a little on the way, while the icon over it fills from the bottom. On the top edge the thin progress line of the song runs and, when it reaches the end, the next cover slides in from the side.
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>
<!--
"Music app bottom bar" 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 music app tab bar with the sliding album cover</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 bottom tab bar of a music app. The marker of the chosen tab is the cover of the song playing, a small
rounded square that slides from tab to tab on a spring and tilts a little on the way; the icon over it fills
in. On the top edge of the bar, the thin line of the song's progress -->
<nav class="bar" aria-label="Main" data-bar>
<span class="bar__edge" aria-hidden="true"></span>
<span class="prog" aria-hidden="true"><span class="prog__fill" data-fill></span></span>
<span class="cover" data-cover aria-hidden="true">
<span class="cover__glow" data-glow></span>
<span class="cover__tilt" data-tilt>
<span class="cover__art" data-art></span>
<span class="cover__sheen" data-sheen></span>
</span>
</span>
<button class="tab" type="button" data-tab aria-current="page">
<svg class="tab__icon" viewBox="0 0 24 24" aria-hidden="true">
<defs><clipPath id="fill-home"><rect data-clip x="-2" y="-2" width="28" height="28"/></clipPath></defs>
<path class="tab__line" d="M4.2 10.4 12 4.1l7.8 6.3v8.4a1.7 1.7 0 0 1-1.7 1.7h-3.4v-5.6H9.3v5.6H5.9a1.7 1.7 0 0 1-1.7-1.7z"/>
<path class="tab__fill" clip-path="url(#fill-home)" d="M4.2 10.4 12 4.1l7.8 6.3v8.4a1.7 1.7 0 0 1-1.7 1.7h-3.4v-5.6H9.3v5.6H5.9a1.7 1.7 0 0 1-1.7-1.7z"/>
</svg>
<span class="tab__label">Home</span>
</button>
<button class="tab" type="button" data-tab>
<svg class="tab__icon" viewBox="0 0 24 24" aria-hidden="true">
<defs><clipPath id="fill-search"><rect data-clip x="-2" y="-2" width="28" height="28"/></clipPath></defs>
<circle class="tab__line" cx="10.6" cy="10.6" r="6.4"/>
<path class="tab__line" d="m15.4 15.4 4.6 4.6"/>
<circle class="tab__fill tab__fill--lens" clip-path="url(#fill-search)" cx="10.6" cy="10.6" r="6.4"/>
<path class="tab__fill tab__fill--stroke" clip-path="url(#fill-search)" d="m15.4 15.4 4.6 4.6"/>
</svg>
<span class="tab__label">Search</span>
</button>
<button class="tab" type="button" data-tab>
<svg class="tab__icon" viewBox="0 0 24 24" aria-hidden="true">
<defs><clipPath id="fill-pods"><rect data-clip x="-2" y="-2" width="28" height="28"/></clipPath></defs>
<rect class="tab__line" x="8.8" y="3.4" width="6.4" height="10.8" rx="3.2"/>
<path class="tab__line" d="M5.8 11.2a6.2 6.2 0 0 0 12.4 0M12 17.4v3.2M9.2 20.6h5.6"/>
<rect class="tab__fill" clip-path="url(#fill-pods)" x="8.8" y="3.4" width="6.4" height="10.8" rx="3.2"/>
<path class="tab__fill tab__fill--stroke" clip-path="url(#fill-pods)" d="M5.8 11.2a6.2 6.2 0 0 0 12.4 0M12 17.4v3.2M9.2 20.6h5.6"/>
</svg>
<span class="tab__label">Podcasts</span>
</button>
<button class="tab" type="button" data-tab>
<svg class="tab__icon" viewBox="0 0 24 24" aria-hidden="true">
<defs><clipPath id="fill-lib"><rect data-clip x="-2" y="-2" width="28" height="28"/></clipPath></defs>
<rect class="tab__line" x="4" y="4.2" width="3.6" height="15.6" rx="1.1"/>
<rect class="tab__line" x="10" y="4.2" width="3.6" height="15.6" rx="1.1"/>
<rect class="tab__line" x="15.6" y="5.2" width="3.6" height="15" rx="1.1" transform="rotate(-14 17.4 12.7)"/>
<rect class="tab__fill" clip-path="url(#fill-lib)" x="4" y="4.2" width="3.6" height="15.6" rx="1.1"/>
<rect class="tab__fill" clip-path="url(#fill-lib)" x="10" y="4.2" width="3.6" height="15.6" rx="1.1"/>
<rect class="tab__fill" clip-path="url(#fill-lib)" x="15.6" y="5.2" width="3.6" height="15" rx="1.1" transform="rotate(-14 17.4 12.7)"/>
</svg>
<span class="tab__label">Library</span>
</button>
</nav>
<p class="sr" aria-live="polite" data-live></p>
<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"/></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.
19 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 “Music app bottom bar” from Animorio and fit it into my siteThe cover’s position is a damped spring worked out on every frame with the GSAP ticker: acceleration equals stiffness times distance minus damping times speed, with the time step capped at 1/30 of a second. Damped under critical, it goes a few pixels past and comes back. When it rests the loop is detached.
The spring’s own speed gives the tilt (speed times TILT, ten degrees at most), the lift and a scale of a few hundredths; the glow behind moves the other way and seems to trail behind. So the cover only tilts while it runs and straightens by itself when it arrives.
Every icon is drawn twice: the line outline and the solid white shape, cut by a clipPath with a rectangle. GSAP raises the rectangle from the bottom through its y attribute, delayed just enough for the cover to have nearly arrived; the one left behind empties the other way.
The progress line is a scaleX of the time played. At the end, the new cover (CSS gradients only: a sunset, a moon, a flower of rings) comes in with xPercent over the old one, the square squeezes on an elastic spring and the --accent variable moves to the new colour.
The cover’s targets are read from the buttons’ positions and read again with a ResizeObserver. The tabs are buttons with aria-current, the arrow keys change tab and an aria-live region says the tab and the song. A drawn pointer taps the tabs in turn; at the first real touch it stops and starts again after six seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
STIFF | script.js | 260 | How stiff the spring carrying the cover is. |
DAMP | script.js | 21 | How much the spring is held back: lower, and the cover goes further past and back. |
TILT | script.js | 0.013 | How much the cover tilts with its speed (0 stays straight). |
SONG | script.js | 8 | Seconds of each song before the next cover comes in. |
FILL | script.js | 0.45 | Seconds for the chosen tab’s icon to fill. |
COVER | script.js | 38 | Side of the cover in pixels. |
START | script.js | 0 | The tab chosen when the page opens (0 is the first). |
In the bottom bar of a music, podcast or radio app, where the song playing stays in sight without an extra mini player. With another picture in the square (a profile photo, a book cover, the latest order) it suits any app that wants something alive inside its navigation.
The same animation: the bar is at most the screen width minus 32 pixels, and the cover’s targets are worked out again when the width changes. A tap chooses the tab and makes it sink for a moment.
Nothing moves: the cover fades out of the tab left and fades in on the chosen one, without tilting; the icons fill quickly, the new song arrives with a fade and the pilot’s pointer is hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.8 KB; the libraries: GSAP 28 KB.
Tested on 11 November 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.