Skip to content
animorio
IT
All components

Voice recording button

Buttons, HoverCanvas, GSAPMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

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.

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>
<!--
  "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>

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.

22 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 “Voice recording 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 an almost black background, in the middle, the chat of the made-up assistant Tamsel: above, its greeting, Morning. What should I take care of today?, below, the pill field with a line drawn plus, Ask Tamsel, or tap the mic and on the right a round white button with a microphone. A fake pointer arrives and presses it: the button squashes and springs back, the microphone turns into the stop square, a soft violet ring lights up round it and a recording pill comes out of the button to the left, covering the field, with the bin, the 00:00 timer in tabular figures starting to count and a waveform of thin bars. The wave follows a fake voice, made of syllables, words and pauses: the new bar enters on the right in white, the others slide left in violet and fade at the edge; behind the pill a violet glow rises from below, lifting and widening with the volume and settling in the pauses, and the button swells a touch with the voice. The pointer passes over the bin, which warms to red, then goes back to the button and presses stop: the wave flattens into a line, the pill closes back into the button, the glow fades and the field returns. In the chat the message rises on the right, its words arriving out of a blur one by one, with Voice · 0:04 and a small microphone below; shortly after the assistant replies the same way. Then the chat clears and it starts again.

How it works

A pill coming out of the button

The 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.

A fake but believable voice

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.

The scrolling wave

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.

The breathing glow

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.

The sent message

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.

Values to change

NameFileDefaultWhat it changes
TRANSCRIPTscript.jsCan you move my three o’clock with Odile to Thursday and send her the new invite?What is said, written as a message.
REPLYscript.jsDone. Thursday at 3:00 PM, and Odile has the new invite.The assistant’s reply.
ACCENTscript.js#8e86ffThe colour of the wave and of the glow.
RECORD_TIMEscript.js4.6The seconds the autopilot records.
GLOWscript.js1How much the glow rises with the voice.
WAVE_HEIGHTscript.js1How tall the wave’s bars are.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • Bars shifted one whole sample at a time looked like a digital clock: they must be shifted by the fraction of a sample already gone, on every frame.
  • The pill is hidden with visibility, not display: that way the canvas already has its size when it opens and the wave does not start squashed.
  • The recording time is counted on GSAP’s ticker, not on the system clock: it stops together with everything else when the page is paused.
  • The clip-path also has round 999px: without it, while the pill comes out its left edge is square.

Libraries

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.

Testing

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