Skip to content
animorio
IT
All components

Push-to-talk button

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

The button of a radio app for teams, on white: hold it and it turns red, the five bars follow the voice, a halo breathes with the volume and the time runs. On release the message rises to the channel chip and “Sent to 4” arrives; then a teammate answers and, while they talk, the button waits in blue. A press that is too short sends nothing.

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>
<!--
  "Push-to-talk 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>Push-to-talk 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 button of a team walkie-talkie app: hold it to talk to the channel, the bars follow the voice,
         letting go sends the message up to the channel and a teammate answers -->
    <div class="pt" data-pt>
      <p class="pt__chan" data-chan><span class="pt__face" data-face aria-hidden="true">MK</span><b>Kitchen crew</b><span class="pt__on">4 on</span></p>
      <div class="pt__well">
        <span class="pt__halo" data-halo aria-hidden="true"></span>
        <button class="pt__btn" type="button" aria-describedby="pt-hint" data-btn>
          <svg class="pt__mic" data-mic viewBox="0 0 28 28" aria-hidden="true"><rect x="10.500" y="4" width="7" height="12.500" rx="3.500"></rect><path d="M7 13.500a7 7 0 0 0 14 0M14 20.500v3.500"></path></svg>
          <span class="pt__bars" data-bars aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span>
        </button>
        <span class="pt__puff" data-puff aria-hidden="true"></span>
      </div>
      <p class="pt__hint" id="pt-hint"><span data-hint>Hold to talk</span></p>
      <span class="pt__say" data-say aria-live="polite"></span>
    </div>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

14 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Push-to-talk 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 white: at the top a grey chip with a disc holding initials, “Kitchen crew” and “4 on”; in the middle a large dark round button with a microphone, inside a pale ring; below, “Hold to talk”. Hold it down and the button tightens a little and turns red, the microphone makes way for five white bars rising and falling with the voice, around it a red halo widens with the volume and the line below counts: “Talking… 0:02”. On release the button goes dark again with a bounce, a red pill leaves the centre and rises to the channel chip, which gives a small jolt, and the words roll into “Sent to 4”. A moment later the initials disc lights up blue, the line says “Mara is talking…”, a blue halo pulses and the button dims: while someone else talks you cannot. Then everything returns to “Hold to talk”. With a press that is too short the button gives a small sideways jolt and the line says “Hold a little longer”.

How it works

Press and release

pointerdown starts a linear tween on one number, the seconds of talk, and captures the pointer; pointerup stops it and looks at how long it lasted.

The voice

On every frame a made-up level comes out of three sines of the time: the five bars read it with scaleY, each at its own pace, and the halo with scale.

Sending

Above MIN seconds a pill leaves the button’s centre and reaches the channel chip, measured at that moment, which bounces; below MIN nothing leaves.

The answer

A delayed call turns on the “teammate talking” state: a class changes the colours, the halo pulses and the button ignores presses until it ends.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff5436The colour of the button while you talk.
THEMscript.js#2f7df6The colour used while a teammate talks.
MINscript.js0.4Below these seconds the press is too short and nothing is sent.
REPLYscript.js2.2For how many seconds the answering teammate talks, in the demo (0 = no answer).
SPRINGscript.js1How much the button and the channel chip bounce: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer talks to the channel, listens to the answer and makes a press that is too short.

Try them in the Playground

When to use it

In apps for people who work on their feet and talk by voice: kitchens and dining rooms, warehouses, building sites, shops, events, rescue. Also in a group chat or a game, where you talk by holding a key.

On phones

The same button, a 96 pixel disc in the middle: it has touch-action none, no text selection and no long-press menu, so the finger can rest on it for as long as you talk.

With reduced motion

In place of the long press, one tap starts and another tap sends (“Tap to talk”). No dancing bars and no flying pill: only the colours and the words change. The demo does not move by itself.

Pitfalls

  • Nothing is recorded here and the volume is made up: in a real app the level comes from the microphone (AnalyserNode) after asking permission.
  • The pointer has to be captured (setPointerCapture) and the press has to end even if the button loses focus, or it stays “on air”.
  • From the keyboard Space and Enter are held like the finger; the key’s auto-repeat has to be ignored (e.repeat).
  • While a teammate talks the button stays in the Tab order but ignores presses: in a real app the reason is also said in words.
  • The sending pill leaves the button’s centre and measures the chip at the moment of release: that way it lands right at any width.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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