
The elastic button
Buttons, Hover, Text
The microphone button at the bottom of an AI assistant’s chat, on black: pressed, it opens into a recording pill with a running timer, a waveform of thin bars that follows the voice and a violet glow rising from below that breathes with the volume. Pressed again, the wave flattens into a line, the pill closes back into the button and the words arrive in the chat as a sent message, then the assistant replies.
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>
<!--
"Voice recording 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 voice recording button</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">
<!-- the composer of an AI assistant, on black: a round microphone button that opens into a recording pill,
with a running timer, a waveform that follows the voice and a soft glow rising from below; stopped, the pill
closes, the wave flattens into a line and the words arrive in the thread as a sent message -->
<section class="chat" data-chat aria-label="Tamsel assistant">
<div class="chat__thread" data-thread aria-live="polite">
<div class="msg msg--bot" data-hello>
<span class="msg__who">Tamsel</span>
<p class="msg__text">Morning. What should I take care of today?</p>
</div>
<div class="msg msg--me" data-me>
<p class="msg__bubble" data-said></p>
<span class="msg__meta" data-meta>
<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="5.6" y="2" width="4.8" height="8" rx="2.4"></rect><path d="M3.4 7.6a4.6 4.6 0 0 0 9.2 0M8 12.2V14"></path></svg>
<span data-meta-text>Voice · 0:00</span>
</span>
</div>
<div class="msg msg--bot msg--reply" data-reply>
<span class="msg__who">Tamsel</span>
<p class="msg__text" data-reply-text></p>
</div>
</div>
<div class="composer" data-composer>
<div class="glow" data-glow aria-hidden="true"></div>
<div class="composer__field" data-field>
<svg class="composer__plus" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 4.5v11M4.5 10h11"></path></svg>
<span class="composer__hint">Ask Tamsel, or tap the mic</span>
</div>
<div class="rec" data-rec role="group" aria-label="Recording">
<button class="rec__bin" type="button" data-bin aria-label="Discard recording">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M4.5 6h11M8 6V4.6h4V6M6 6l.7 9.4h6.6L14 6M8.7 8.6v4.6M11.3 8.6v4.6"></path></svg>
</button>
<span class="rec__time" data-time>00:00</span>
<canvas class="rec__wave" data-wave aria-hidden="true"></canvas>
</div>
<button class="mic" type="button" data-mic aria-label="Record a voice message" aria-pressed="false">
<span class="mic__face">
<svg class="mic__icon mic__icon--mic" data-icon-mic viewBox="0 0 20 20" aria-hidden="true"><rect x="7.2" y="2.6" width="5.6" height="9.2" rx="2.8"></rect><path d="M4.6 9.4a5.4 5.4 0 0 0 10.8 0M10 14.8v2.6"></path></svg>
<svg class="mic__icon mic__icon--stop" data-icon-stop viewBox="0 0 20 20" aria-hidden="true"><rect x="6.2" y="6.2" width="7.6" height="7.6" rx="2.2"></rect></svg>
</span>
</button>
</div>
<p class="chat__foot" data-foot>Voice is turned into text on your device.</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>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.
22 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 “Voice recording button” from Animorio and fit it into my siteThe recording pill sits on top of the field, as wide as it, and is hidden by an inset clip-path with 100% on the left: GSAP takes that value to 0 in 0.55 seconds with expo.out, and the pill seems to come out of the button to the left. To close it goes back to 100% with power3.in, once the wave has flattened.
The voice is a list of syllables generated once from a fixed random seed: each syllable lasts 110 to 210 thousandths, has its own strength, and syllables group into words and phrases with pauses in between. The level at any instant is the bump (half a sine) of the current syllable, plus a tiny tremble.
Every 70 thousandths the level goes onto the end of a list; the canvas draws the bars from right to left, one every 5 pixels, shifted by the fraction of a sample already gone, so they slide smoothly instead of jumping. The new bar is white, the others violet, and they fade at the left edge. Flattening them takes one number, flat, that GSAP moves from 1 to 0.
Behind the pill there is a blurred violet radial gradient, anchored at the bottom. On every frame the voice level, smoothed, sets its opacity and how much it stretches upwards: it rises on the words and settles in the pauses. The button grows by 3.5% at most with the same level.
Once recording stops, the message rises on the right on a spring and the sentence is split into words that come out of a blur 50 thousandths apart; below sits the real length of the recording. The assistant’s reply arrives shortly after the same way. The autopilot is a single timeline; at the first real touch or key it stops and the button really works, bin included.
| Name | File | Default | What it changes |
|---|---|---|---|
TRANSCRIPT | script.js | Can you move my three o’clock with Odile to Thursday and send her the new invite? | What is said, written as a message. |
REPLY | script.js | Done. Thursday at 3:00 PM, and Odile has the new invite. | The assistant’s reply. |
ACCENT | script.js | #8e86ff | The colour of the wave and of the glow. |
RECORD_TIME | script.js | 4.6 | The seconds the autopilot records. |
GLOW | script.js | 1 | How much the glow rises with the voice. |
WAVE_HEIGHT | script.js | 1 | How tall the wave’s bars are. |
For the field of an AI assistant that takes voice, a chat’s voice messages, dictating notes or emails, voice search in an app or a shop.
The same animation with adapted sizes: the pill covers the whole field even at 341 pixels, the wave takes fewer bars because it draws one every 5 pixels of width, and the chat thread has a height measured in vh, so the reply does not move the field. A tap presses the button like a click.
The pill fades in and out, the wave stays still with bars of different heights, the glow is constant and does not breathe, and the message’s words fade in without moving.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.1 KB; the libraries: GSAP 28 KB.
Tested on 25 October 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.