Skip to content
animorio
IT
All components

Download episode button

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

The Download episode button of a podcast app, on black: a graphite pill with a cream disc and an arrow. Pressed, the episode’s waveform rises from the middle inside the pill and every bar turns to warm metal as the bytes arrive, with a head of light at the front, the ring closing around the icon and the percentage running. When the download ends the waveform packs like an accordion into the icon, which becomes an amber disc with a check, and the pill closes on a spring around Saved offline. A second tap removes the episode and the pill opens again.

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>
<!--
  "Download episode 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 Download episode button with the waveform packing into the pill</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>
    <!-- one gesture: saving a podcast episode offline. The episode's waveform rises inside the pill, every bar turns to
         warm metal as its bytes arrive, then the whole waveform packs into the icon like an accordion and the pill
         closes around Saved offline. A second press removes the download and the pill opens again -->
    <button class="btn" type="button" data-btn aria-label="Download episode 48 of The Long Signal, 41 MB">
      <span class="btn__body" data-body>
        <span class="btn__glow" data-glow aria-hidden="true"></span>
        <span class="btn__edge" aria-hidden="true"></span>
        <span class="btn__sheen" data-sheen aria-hidden="true"></span>

        <span class="icon" data-icon aria-hidden="true">
          <span class="icon__disc" data-disc></span>
          <span class="icon__disc icon__disc--fatto" data-disc-done></span>
          <svg class="icon__svg" viewBox="0 0 40 40">
            <circle class="ring__track" data-track cx="20" cy="20" r="18.25"></circle>
            <circle class="ring__fill" data-ring cx="20" cy="20" r="18.25"></circle>
            <g data-arrow>
              <path class="icon__line" d="M20 12.2v12.6"></path>
              <path class="icon__line" d="M15.1 20.2 20 25.1l4.9-4.9"></path>
            </g>
            <path class="icon__line icon__tray" data-tray d="M14 28.4h12"></path>
            <path class="icon__line icon__check" data-check d="M14.2 20.6l3.9 3.9 7.8-8.4"></path>
          </svg>
        </span>

        <span class="txt txt--rest" data-rest>
          <span class="txt__main" data-rest-main>Download episode</span>
          <span class="txt__meta" data-rest-meta>41 MB</span>
        </span>

        <canvas class="wave" data-wave aria-hidden="true"></canvas>
        <span class="pct" data-pct aria-hidden="true"><span data-pct-n>0</span><span class="pct__s">%</span></span>

        <span class="txt txt--done" data-done>
          <span class="txt__main" data-done-main>Saved offline</span>
          <span class="txt__meta" data-done-meta>Ep. 48</span>
        </span>
      </span>
    </button>
    <span class="sr" aria-live="polite" data-live></span>

    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.2 18.6 13l-6.1.9 3.6 6.6-2.6 1.4-3.6-6.6L5.3 19.6z"></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.

27 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 “Download episode 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 a black background there is only a graphite pill, 60 pixels tall, with a one-pixel edge that catches light where the pointer goes: on the left a cream disc with the download arrow and its tray, then Download episode and on the right the size, 41 MB. Hovering lifts the pill by a pixel, the arrow leans down, the disc swells slightly and the label widens on the font’s width axis. Pressed, the button gives and springs back: the labels rise and vanish, the cream disc draws back leaving a thin ring, the arrow turns amber and starts breathing downwards, and from the middle the episode’s waveform rises, forty thin bars lifting with a small bounce from the centre to the edges. The download comes in bursts like a real network: as each byte arrives its bar lights up in warm metal, swells for a moment and settles, an amber line of light marks the front, a reflection slides slowly over the bars already downloaded, a glow under the pill follows the front, the ring closes around the icon and the percentage runs in equal-width digits. At one hundred per cent the arrow drops into the tray and is gone, and the waveform packs like an accordion towards the icon, the far bars first; the icon takes them, becomes an amber metal disc that overshoots by a pixel and settles, the check is drawn, the pill closes on a spring around Saved offline · Ep. 48 and a pass of light crosses it. A second tap removes the episode: the check is wiped, the cream disc returns with the arrow coming down from above and the pill widens again. Tapping halfway through cancels it: the bars switch off backwards and the waveform sinks back into its line. A drawn pointer does it all by itself and steps aside at the first touch.

How it works

Four numbers for one drawing

The waveform is a canvas redrawn every frame from four numbers that GSAP moves: how far the wave is out, how much is downloaded, how packed it is and how alive it is. The bars are not page elements: the whole trick is in the function that draws them, and when nothing moves the canvas is not redrawn.

A believable wave

The amplitudes come from three summed sine waves taken as absolute values, with a 22% floor: it looks like the profile of a voice, it is the same at every load and no audio file is needed.

The byte arriving

For each bar the download front gives a value from 0 to 1 that fades grey into metal; right after it passes, a damped sine swells it by 20% and brings it back, so every bar settles in its own small way. The metal is a vertical gradient with the light in the middle, and on top a bright band slides in source-atop only over the bars already downloaded.

The accordion

When packing, each bar has its own timing: the farthest starts first, with a cubic acceleration, and they all reach the edge of the icon together while shortening and fading. The icon takes them with a one-pixel knock and the amber disc comes in with back.out.

The pill closing

The final width is measured from the Saved offline label and the episode after the font has loaded, and the pill reaches it with elastic.out set by the MOLLA knob; at the same time a pass of light crosses it diagonally.

Values to change

NameFileDefaultWhat it changes
ETICHETTAscript.js"Download episode"The button label at rest.
PESOscript.js"41 MB"How big the episode is, on the right.
FATTOscript.js"Saved offline"The label once the episode is saved.
EPISODIOscript.js"Ep. 48"The episode, next to the final label.
DURATAscript.js3.4How long the download takes, in seconds.
BARREscript.js40How many bars the episode’s waveform has.
COMPRESSIONEscript.js0.72How long the waveform takes to pack into the icon, in seconds.
MOLLAscript.js0.62How soft the spring of the closing pill is: lower bounces more.
ATTESAscript.js2.2How long it stays saved before the drawn pointer removes it, in seconds.

Try them in the Playground

When to use it

On an episode page of a podcast app, in the track or album list of a music app, in an audiobook or course app: anywhere you save something to listen to without a connection.

On phones

The same 60-pixel pill, almost as wide as the screen, with the same animations: a tap starts the download, a tap halfway cancels it and a tap on the saved pill removes it.

With reduced motion

No rising wave, accordion or springs: on tap the labels fade, the waveform appears whole and the bars light up in metal one after the other in colour only; at the end the pill fades to the size of Saved offline with the check already drawn. The drawn pointer does not run.

Pitfalls

  • The icon arrows take their colour from the paths’ class: changing the group’s stroke does nothing, because the child’s CSS wins. GSAP colours the two paths, not the group.
  • The pill narrows after the waveform has packed: if the canvas followed the pill’s width it would have to be resized mid-draw. The canvas keeps the resting pill’s width and the pill clips it as it closes.
  • The width of Saved offline changes when the variable font arrives: measured at once it was narrower and the closed pill cut the episode off. It is measured again on document.fonts.ready and on every resize.
  • The reflection over the bars in source-atop paints on any pixel already drawn, grey bars too: it has to be clipped with a rectangle up to the download front.
  • A pass of light placed with a CSS transform and then animated with xPercent stayed stuck halfway: GSAP read the CSS percentage as pixels. GSAP sets the starting position.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 10 November 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