Skip to content
animorio
IT
Back to the library

Glass now playing widget

Hover, ImagesGSAP, CSS onlyMediumCompressed weight: Demo 8.7 KBGSAP 28 KBFreeDownload the zip

A made-up app’s music player on the lock screen: a frosted glass widget that takes the colours of the album cover. At every new track the cover slides away, three drops of colour fall from its edge and the new tint spreads through the glass like a liquid, while the border, the clock and the light behind change with it. You change track by dragging the widget or with the drawn buttons, which press on a spring. Libraries.dev style: light and glass on a real piece.

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>
<!--
  "Glass now playing widget" 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>Noctune · Now playing</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the now playing widget of a made-up music app, Noctune, on a lock screen: frosted glass that takes the colours
       of the cover, which drip from the cover into the glass at every new track; drag the widget to change track -->
  <main class="palco" data-palco>
    <div class="alone" data-alone aria-hidden="true"></div>

    <section class="schermo" data-schermo>
      <header class="ora">
        <p class="giorno">Wednesday 28 October</p>
        <p class="orario" data-orario>22:04</p>
      </header>

      <article class="widget" data-widget aria-label="Now playing">
        <div class="tinta" data-tinta aria-hidden="true"></div>
        <div class="tinta nuova" data-tinta-nuova aria-hidden="true"></div>
        <div class="gocce" data-gocce aria-hidden="true">
          <span class="goccia"></span><span class="goccia"></span><span class="goccia"></span>
        </div>
        <div class="riflesso" data-riflesso aria-hidden="true"></div>
        <div class="bordo" aria-hidden="true"></div>

        <div class="contenuto">
          <div class="riga">
            <div class="copertine" data-copertine>
              <svg class="copertina" data-copertina="0" viewBox="0 0 64 64" aria-hidden="true">
                <defs>
                  <linearGradient id="cA" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ff8a5c"/><stop offset="0.62" stop-color="#ffb35a"/><stop offset="1" stop-color="#5a2a4a"/></linearGradient>
                </defs>
                <rect width="64" height="64" fill="url(#cA)"/>
                <circle cx="32" cy="34" r="12" fill="#fff3d6" opacity="0.92"/>
                <path d="M0 42h64v22H0z" fill="#3c1f3d" opacity="0.88"/>
                <path d="M8 46h20M36 46h18M14 50h14M34 50h22M20 54h24" stroke="#ffcf8a" stroke-width="1.2" stroke-linecap="round" opacity="0.7"/>
              </svg>
              <svg class="copertina" data-copertina="1" viewBox="0 0 64 64" aria-hidden="true">
                <defs>
                  <linearGradient id="cB" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#2fc3b0"/><stop offset="1" stop-color="#3550d6"/></linearGradient>
                </defs>
                <rect width="64" height="64" fill="url(#cB)"/>
                <path d="M32 12 50 44H14Z" fill="none" stroke="#e8fffb" stroke-width="1.6" stroke-linejoin="round" opacity="0.9"/>
                <path d="M32 12 38 44" stroke="#e8fffb" stroke-width="1" opacity="0.55"/>
                <path d="M41 30 64 26M42 33 64 33M43 36 64 40" stroke="#ffe27a" stroke-width="1.2" opacity="0.85"/>
                <path d="M0 30 24 30" stroke="#ffffff" stroke-width="1.4" opacity="0.85"/>
              </svg>
              <svg class="copertina" data-copertina="2" viewBox="0 0 64 64" aria-hidden="true">
                <defs>
                  <linearGradient id="cC" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="#6b36f2"/><stop offset="1" stop-color="#e04fcf"/></linearGradient>
                </defs>
                <rect width="64" height="64" fill="url(#cC)"/>
                <path d="M-4 52C12 40 20 56 34 42S52 30 68 22" fill="none" stroke="#ffd2f4" stroke-width="1.5" opacity="0.9"/>
                <path d="M-4 58C12 46 20 62 34 48S52 36 68 28" fill="none" stroke="#ffd2f4" stroke-width="1" opacity="0.55"/>
                <path d="M-4 46C12 34 20 50 34 36S52 24 68 16" fill="none" stroke="#ffd2f4" stroke-width="1" opacity="0.35"/>
                <circle cx="46" cy="18" r="5" fill="none" stroke="#fff" stroke-width="1.2" opacity="0.8"/>
              </svg>
              <span class="lucido" aria-hidden="true"></span>
            </div>

            <div class="testi">
              <p class="app">
                <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 11.5V5.2l8-1.7v6.3" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/><circle cx="4.6" cy="11.6" r="1.7" fill="currentColor"/><circle cx="9.4" cy="10.4" r="1.7" fill="currentColor"/></svg>
                <span>Noctune</span>
              </p>
              <p class="titolo"><span class="rullo" data-titolo>Salt Lantern</span></p>
              <p class="artista"><span class="rullo" data-artista>Marlo Vey</span></p>
            </div>
          </div>

          <div class="tempo">
            <div class="pista" data-pista>
              <div class="pieno" data-pieno></div>
              <div class="scia" data-scia></div>
            </div>
            <div class="numeri">
              <span data-passato>1:12</span>
              <span data-resto>-2:12</span>
            </div>
          </div>

          <div class="tasti">
            <button class="tasto piccolo" type="button" data-prima aria-label="Previous track">
              <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6v12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M19 6.6v10.8a.8.8 0 0 1-1.2.7L9.3 12.7a.8.8 0 0 1 0-1.4l8.5-5.4a.8.8 0 0 1 1.2.7Z" fill="currentColor"/></svg>
            </button>
            <button class="tasto grande" type="button" data-play aria-label="Pause" aria-pressed="true">
              <svg viewBox="0 0 24 24" aria-hidden="true">
                <g data-icona-pausa><rect x="6.5" y="5" width="3.6" height="14" rx="1.2" fill="currentColor"/><rect x="13.9" y="5" width="3.6" height="14" rx="1.2" fill="currentColor"/></g>
                <path data-icona-play d="M8 5.6v12.8a.9.9 0 0 0 1.4.8l10-6.4a.9.9 0 0 0 0-1.5l-10-6.4A.9.9 0 0 0 8 5.6Z" fill="currentColor"/>
              </svg>
            </button>
            <button class="tasto piccolo" type="button" data-dopo aria-label="Next track">
              <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M18 6v12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 6.6v10.8a.8.8 0 0 0 1.2.7l8.5-5.4a.8.8 0 0 0 0-1.4L6.2 5.9A.8.8 0 0 0 5 6.6Z" fill="currentColor"/></svg>
            </button>
          </div>
          <p class="dove">
            <svg viewBox="0 0 16 16" aria-hidden="true"><rect x="4" y="2" width="8" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="8" cy="9.6" r="2" fill="none" stroke="currentColor" stroke-width="1.2"/></svg>
            <span>Kitchen speaker</span>
          </p>
        </div>
      </article>
      <p class="aiuto" data-aiuto>Drag to change track</p>
    </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.

20 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 “Glass now playing widget” 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 near black background sits a phone lock screen: the date, a large thin clock and below it the now playing widget of Noctune, a made-up app, in frosted glass. Inside are the drawn album cover (a sunset over the sea, a prism, purple waves), the title, the artist, the track bar with a streak of light at its head moving with time, the minutes played and left, the previous, pause and next buttons and the speaker it plays on. The glass takes the colours of the cover: a soft tint inside, the light on the border turning towards the pointer, a glow behind the widget and even the clock warming up. At every new track the old cover slides away on the side of the gesture and the new one arrives on a spring; three drops fall from the edge of the cover, stretch and splash, and the new colour spreads through the glass like a liquid, sagging a little downwards; the widget dips under the weight of the colour and comes back up. You change track by dragging the widget sideways, which follows like a rubber band, or with the buttons; pause swaps the icon on a spring and dims the light a little. Hovering tilts the widget and the reflection follows the pointer. The autopilot shows it all with a fake pointer.

How it works

The glass and its colours

The widget has a backdrop-filter with blur and saturation over a blurred glow behind it. Every colour comes from two CSS variables, --a and --b: the tint inside the glass, the border (a conic-gradient cut by a mask into a one pixel line), the glow, the bar and the clock. Changing track means sliding --a and --b with GSAP, which can animate colour variables.

The colour that drips

Above the tint there is a second one, with the new colours in --a2 and --b2, hidden by a clip-path. First the drops fall, three spans starting from the edge of the cover, stretching in scaleY as they go down and widening as they vanish; then the clip-path is an ellipse that grows from the centre of the cover and moves a little lower at every step, so the colour seems to drip. At the end the old variables are already the new ones and the ellipse goes back to zero.

Dragging like a rubber band

The widget follows the finger with resistance, the finger to the power of 0.82 and then halved, and the cover a little less, so you can tell there is something underneath to pull. Beyond DRAG_THRESHOLD pixels the release changes track on the side of the gesture; either way the widget goes back to the centre with elastic.out.

Time and buttons

Time runs in the GSAP ticker only while the track plays: the bar is a scaleX and the streak of light follows it with a percentage left. Play and pause are two SVG icons swapping scale and opacity, pause with a back.out return; every pressed button squeezes and lights a glass circle behind itself.

Values to change

NameFileDefaultWhat it changes
DRIPscript.js1.2The seconds the new cover’s colour takes to drip and fill the glass.
DROPSscript.js3How many drops fall from the cover when the track changes (0 = none).
TILTscript.js7How many degrees the widget leans toward the pointer.
DRAG_THRESHOLDscript.js60How many pixels you need to drag to change track.
GLOWscript.js0.55How visible the cover’s light is on the screen behind the glass.
AUTO_PILOTscript.js11 shows the gestures with a fake pointer until someone touches, 0 turns it off.

Try them in the Playground

When to use it

For a music or podcast app, the launch page of a player or a speaker, or to show a system widget in a product presentation: wherever the cover should give its colour to the whole interface.

On phones

The same widget, almost as wide as the screen: you drag it with a finger to change track and the buttons stay large enough for a thumb.

With reduced motion

The widget does not tilt or bounce and the drops do not fall: when the track changes, cover, title and colours crossfade.

Pitfalls

  • A one pixel gradient border is an element on top, with padding 1px and two composited masks (content-box and border-box, xor or exclude): a border-image does not follow rounded corners.
  • The clip-path of the new colour must be computed in pixels from the real position of the cover in the widget at the moment of the change: in percentages the drip would start from the wrong centre when the widget changes width.
  • The same element must not have a quickTo and a tween on the same property: dragging moves x with set and the elastic return takes it afterwards, while the tilt belongs entirely to the quickTo.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.7 KB; the libraries: GSAP 28 KB.

Testing

Tested on 28 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 animations