Skip to content
animorio
IT
All components

Listen button with player

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

The Listen button under an article, with a single gesture: pressed, it squeezes, the label leaves and the pill stretches into a small audio player, with a pause button, a row of bars moving with the voice, the time left and the speed. In the text above, a soft marker follows the word being read. The X folds it back into the pill.

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>
<!--
  "Listen button with 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 Listen button that opens into a small audio player</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- one gesture: press. Under an essay, a Listen pill. Pressed, it squeezes, the label leaves and the pill
         stretches into a small player: pause, a row of level bars that move with the voice, the time left and the
         speed. In the text above, a soft marker follows the word being read -->
    <article class="post" aria-label="Essay">
      <p class="post__kicker">Fieldnote &middot; Essay</p>
      <h1 class="post__title">Why the best tools feel quiet</h1>
      <p class="post__text" data-text>A good tool never asks for your attention. It waits on the desk, does one thing well, and lets you forget it is there until the work is done.</p>

      <div class="post__foot">
        <span class="post__meta">By Ines Calder</span>

        <div class="listen" data-listen>
          <span class="listen__bg" data-bg aria-hidden="true"></span>

          <button class="listen__open" type="button" data-open aria-label="Listen to this essay, 6 minutes">
            <svg class="ico ico--phones" viewBox="0 0 24 24" aria-hidden="true">
              <path d="M4.5 15v-3a7.5 7.5 0 0 1 15 0v3"></path>
              <rect x="3.5" y="14" width="4" height="6" rx="1.6"></rect>
              <rect x="16.5" y="14" width="4" height="6" rx="1.6"></rect>
            </svg>
            <span class="listen__word">Listen</span>
            <span class="listen__dur">6 min</span>
          </button>

          <div class="player" data-player hidden>
            <button class="player__toggle" type="button" data-toggle aria-label="Pause">
              <svg class="ico ico--pause" data-ico-pause viewBox="0 0 24 24" aria-hidden="true">
                <rect x="6.5" y="5.5" width="3.6" height="13" rx="1.2"></rect>
                <rect x="13.9" y="5.5" width="3.6" height="13" rx="1.2"></rect>
              </svg>
              <svg class="ico ico--play" data-ico-play viewBox="0 0 24 24" aria-hidden="true">
                <path d="M8 5.6v12.8a.9.9 0 0 0 1.37.77l10.2-6.4a.9.9 0 0 0 0-1.54L9.37 4.83A.9.9 0 0 0 8 5.6Z"></path>
              </svg>
            </button>
            <span class="player__bars" data-bars aria-hidden="true"></span>
            <span class="player__time" data-time aria-live="off">-6:12</span>
            <button class="player__speed" type="button" data-speed aria-label="Playback speed 1x">
              <span class="speed__win"><span class="speed__lab" data-speed-lab>1x</span></span>
            </button>
            <button class="player__close" type="button" data-close aria-label="Close player">
              <svg class="ico ico--close" viewBox="0 0 24 24" aria-hidden="true">
                <path d="M7 7l10 10M17 7 7 17"></path>
              </svg>
            </button>
          </div>
        </div>
      </div>
    </article>

    <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 “Listen button with 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 white background there is the start of an essay from an invented magazine: the kicker Fieldnote · Essay, the headline in a thin serif, Why the best tools feel quiet, one sentence and, at the bottom, the byline and a white pill with a thin border: drawn headphones, Listen and, in grey, 6 min. Pressed, the pill squeezes and springs back; the headphones and the words rise and fade one after the other, and only then does the pill stretch with a small bounce and the player arrive inside it: a round blue button with pause, growing in from small, eighteen thin bars rising one after another, the time left, -6:12, the speed button, 1x, and an X. The bars move with the voice, each at its own pace, and the ones already heard turn blue; the time goes down second by second. In the text above a soft blue marker slides from word to word, and the words already read turn darker. The speed button sends 1x up and brings 1.5x and then 2x in from below, and the voice runs faster. Pause turns into play (one icon leaves, then the other comes) and the bars settle gently; play sets them moving again. The X takes the player away piece by piece while the pill narrows, and Listen comes back. A drawn pointer shows the round trip by itself until you touch something.

How it works

First it leaves, then it stretches

The headphones and the two words rise 8 pixels and fade in 0.16 seconds, one after the other; only then does the pill go from the width of Listen to the width of the player, both measured for real, with back.out.

The bars and the voice

Every bar has its own height, taken from a profile that looks like a spoken sentence, and its own pace: on every frame the height swings between 55 and 100 per cent of that base. One single number, the level, takes all the bars from rest to motion and back.

The marker

The paragraph is split into words; a rounded rectangle behind the text takes the position and size of the word being read and slides onto it in 0.28 seconds with power3.out. It moves on at 2.6 words a second, times the speed.

One icon, one label at a time

Pause and play never cross: one shrinks and fades, then the other arrives with back.out. The same for the speed: 1x goes up out of its window before 1.5x comes in from below.

Closing without an empty pill

On the X the player’s pieces shrink from right to left and the pill narrows together with them; Listen comes back when the pill is almost at its size.

Values to change

NameFileDefaultWhat it changes
MINUTESscript.js6.2How long the reading of the article lasts, in minutes.
BARSscript.js18How many level bars the player has.
WORDS_PER_SECscript.js2.6How many words a second the marker follows at 1x speed.
OPENscript.js0.55How long the pill takes to open into the player, in seconds.
SQUEEZEscript.js0.95How much the button squeezes when pressed (1 = not at all).
LIVELYscript.js1How much the bars move with the voice (0 = still).
ACCENTscript.js#2f54ebThe player colour: the button, the bars already heard and the marker.

Try them in the Playground

When to use it

Under the articles of a blog, a magazine or a newspaper you can listen to, in newsletters read aloud, in reading apps and on sites with text to speech: anywhere a long text can also be heard.

On phones

The same animations, with the pill moving under the byline when the screen is narrow; a finger presses like the mouse and the player’s buttons are big enough to tap.

With reduced motion

No squeezes, stretches or moving bars: the pill changes face with a fade, the bars stay still at their height, the marker jumps from word to word and the time still goes down. The drawn pointer does not run.

Pitfalls

  • The player width has to be measured with the player visible but out of the flow (static and max-content): measured while hidden it is zero and the pill closes on itself.
  • Pause and play sit in the same spot: if they fade together, for a moment you see an odd mark. One leaves first, then the other comes in.
  • The marker has to be put back on its word on resize, because the words wrap at a different point when the width changes.
  • One single ticker for the bars and the time: a GSAP tween per bar, rebuilt on every frame, would fill the memory in a few minutes.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0.

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

Testing

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