Skip to content
animorio
IT
Back to the library

Voice mode button

WebGL, HoverWebGL, GSAP, CSS onlyMediumCompressed weight: Demo 9.9 KBGSAP 28 KBFreeDownload the zip

The voice mode of a made-up AI assistant, Halcy, on a near black card: a ribbon of light made of five thin strands crosses the card and runs through a big glass button that magnifies it like a lens. Tap the button and you talk: the ribbon swells and ripples with the loudness of the voice (a made-up voice built from syllables in the code: nothing is recorded) and the words land in the caption as they are said. Then the strands gather into a ring inside the glass while the assistant thinks, and open again, warmer, peach and rose, while it answers. The ribbon leans toward the pointer. All in one WebGL shader on a flat rectangle, with three CSS bands if WebGL is missing.

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 mode 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 mode button with a ribbon of light that follows the voice</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>
    <!-- the voice mode of a made-up AI assistant, Halcy. A ribbon of light made of five strands runs across the card and
         through the big glass button; it swells and ripples with the voice (made up, never recorded), gathers into a
         ring while the assistant thinks, warms up while it answers, and bends toward the pointer -->
    <section class="card" data-card aria-label="Halcy voice mode">
      <canvas class="card__gl" data-gl aria-hidden="true"></canvas>
      <div class="card__fallback" aria-hidden="true"><span></span><span></span><span></span></div>
      <span class="card__sheen" aria-hidden="true"></span>

      <header class="top">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M3 10c2.2-4.2 4.4-4.2 6.6 0s4.4 4.2 7.4 0" />
            <path class="brand__faint" d="M3 13.4c2.2-2.6 4.4-2.6 6.6 0s4.4 2.6 7.4 0" />
          </svg>
          <span class="brand__name">Halcy</span>
        </span>
        <span class="state" data-state>
          <span class="state__words">
            <span class="state__word" data-word>Voice</span>
          </span>
          <span class="state__time" data-time>0:00</span>
        </span>
      </header>

      <div class="core">
        <button class="talk" type="button" data-talk aria-label="Start talking">
          <span class="talk__rim" aria-hidden="true"></span>
          <span class="talk__glint" aria-hidden="true"></span>
          <svg class="talk__mic" data-mic viewBox="0 0 24 24" aria-hidden="true">
            <rect x="9" y="3.2" width="6" height="11" rx="3" />
            <path d="M5.6 11.4a6.4 6.4 0 0 0 12.8 0" />
            <path d="M12 17.8v3" />
          </svg>
        </button>
      </div>

      <div class="caption" data-caption aria-live="polite">
        <p class="caption__who" data-who>Tap to talk</p>
        <p class="caption__line" data-line></p>
      </div>

      <footer class="tools">
        <button class="tool" type="button" aria-label="Mute" data-mute>
          <svg viewBox="0 0 24 24" aria-hidden="true">
            <rect x="9" y="3.2" width="6" height="11" rx="3" />
            <path d="M5.6 11.4a6.4 6.4 0 0 0 12.8 0" />
            <path d="M12 17.8v3" />
            <path class="tool__slash" d="M4.5 4.5l15 15" />
          </svg>
        </button>
        <span class="tools__hint" data-hint>Halcy can make mistakes. Check what matters.</span>
        <button class="tool tool--end" type="button" aria-label="End voice mode" data-end>
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17" /></svg>
        </button>
      </footer>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z" />
    </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 “Voice mode 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 near black ground sits a dark card with soft corners, a one pixel edge catching the light at the top and a wide shadow with a blue tint. At the top the Halcy mark (two waves, the second fainter) and a glass pill with the state, Voice, and the time of the conversation. In the middle a big round glass button with a drawn microphone, a highlight on top and a thread of light slowly turning on its edge. Behind it, in the card, runs a ribbon of light made of five thin strands, silver when still: inside the glass the ribbon is bigger and brighter, as seen through a lens. Tap the button and it squashes and springs back, the microphone fades, the pill says Listening and the ribbon turns ice blue and lilac: it swells at every syllable of the voice and settles in the pauses, taller in the middle and calm toward the edges, while the words of the question, «Find us a quiet table for two tonight, around eight.», come out of the blur one by one. When the question ends the strands narrow and gather into a ring inside the glass with light running around it: the pill says Thinking. Then the ring opens into a peach and rose ribbon moving with the answer, «Booked: Larchmere, 8:15, the window table. I sent it to Theo.», and at the end everything turns silver and quiet again. The ribbon leans toward the pointer, only near where it is. At the bottom, the button to mute the microphone and the red one to close.

How it works

A rectangle and a shader

The canvas covers the whole card and draws one triangle as big as the screen: everything else happens in the fragment shader, pixel by pixel. The canvas stays under 600 thousand pixels even on dense screens, because the light is soft and more only costs more.

Five strands

Each strand is a sum of three sines with their own frequency and speed, times a bell that keeps it tall in the middle and flat toward the edges. For every pixel the shader measures how far it is from each strand and adds a thin core and a wide halo; the middle strand counts double. The sum goes through 1 − exp(−light), so crossing strands brighten without burning out.

The lens

Inside the button's circle the coordinates are pulled toward the centre, more in the middle and not at all at the edge: the ribbon behind the glass looks bigger. The light inside is 40% stronger. The button's centre and radius are measured without the scale GSAP puts on it when it is pressed.

A made-up voice

Each sentence is split into words and each word into syllables, one every three letters, each a little different in length and loudness; after a comma or a full stop there is a longer pause. The loudness at any moment is the sum of small curves that rise in 5 hundredths of a second and fall in 11. The ribbon follows it fast going up and slower coming down, and each word of the caption lights up at the moment it starts.

It thinks, it answers

One GSAP timeline runs the conversation: listening, thinking, answering, back to rest. While it thinks the strands fade and a ring is born at 60% of the radius, with light running around it; the colours of the four moments slide from one pair to the next.

Values to change

NameFileDefaultWhat it changes
SPEEDscript.js1How fast the strands ripple (0 holds them still).
SWELLscript.js1How much the ribbon swells with the voice.
THICKNESSscript.js1How thick the strands of light are.
GLOWscript.js1How wide the soft glow around the strands is.
LENSscript.js1How much the glass button magnifies the ribbon behind it (0 is flat glass).
BENDscript.js1How much the ribbon leans toward the pointer (0 ignores it).
THINK_FORscript.js1.5Seconds the assistant thinks, with the strands gathered into a ring.
AUTO_PILOTscript.js1.2Seconds before the drawn pointer starts a conversation (0 never).

Try them in the Playground

When to use it

For the voice mode of an AI assistant, a booking app, a guide or a voice customer service: wherever the speaker needs to see at a glance that the app is listening, when it is thinking and when it answers.

On phones

The same animation with adapted sizes: the card takes almost the whole width and height, the button is sized on the shorter side of the screen, the line at the bottom hides when the height is short. The ribbon leans toward the finger while it rests on the card.

With reduced motion

The ribbon stands still, half open, and does not bend; no squash and no movement. The conversation still plays: the colours change with a fade, the thinking ring appears and goes, the caption words fade in.

Pitfalls

  • Measuring the button with getBoundingClientRect while GSAP scales it moves the lens centre at every press: take the centre from its container and the radius from offsetWidth, which ignore the scale.
  • A WebGL canvas as big as the card on a dense screen costs millions of pixels a frame: the light is soft, so keep it under 600 thousand and let the browser stretch it.
  • Adding up the strands' light with no curve burns the crossings into flat white: 1 − exp(−light) brightens them and keeps them apart.
  • Loudness that follows the syllables at the same speed up and down makes the ribbon shiver: it rises fast and falls slowly, like a real meter.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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