Skip to content
animorio
IT
All components

SOS button

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

The emergency button of a safety app, built not to fire by mistake: hold it for three seconds while the ring closes around the red disc and the count goes 3, 2, 1. Let go early and nothing happens; hold to the end and the pill floods red, calls 112, someone answers, and one tap ends the call.

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>
<!--
  "SOS 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>SOS 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">
    <!-- an SOS button for a safety app: hold it while the ring closes and 3, 2, 1 count down; let go early and
         nothing happens; hold to the end and the pill floods red, calls, connects, and one tap ends the call -->
    <button class="sos" type="button" data-sos aria-describedby="sos-say">
      <span class="sos__fill" data-fill aria-hidden="true"></span>
      <span class="sos__disc" aria-hidden="true">
        <svg viewBox="0 0 52 52"><circle class="sos__track" cx="26" cy="26" r="24"></circle><circle class="sos__ring" data-ring cx="26" cy="26" r="24" pathLength="1" transform="rotate(-90 26 26)"></circle></svg>
        <b>SOS</b>
      </span>
      <span class="sos__roll sos__label"><span data-label>Hold for help</span></span>
      <span class="sos__right" aria-hidden="true">
        <span class="sos__roll sos__digit" data-digitbox><span data-digit>3</span></span>
        <svg class="sos__phone" data-phone viewBox="0 0 28 28">
          <path class="sos__handset" d="M8.200 5.500h3l1.500 4-2 1.400a11 11 0 0 0 5 5l1.400-2 4 1.500v3a1.800 1.800 0 0 1-2 1.800A15.500 15.500 0 0 1 6.400 7.500a1.800 1.800 0 0 1 1.800-2Z"></path>
          <path class="sos__wave" data-wave pathLength="1" d="M16 8.500a4.500 4.500 0 0 1 4 4"></path>
          <path class="sos__wave" data-wave pathLength="1" d="M16.500 4.500a8.500 8.500 0 0 1 7.500 7.500"></path>
        </svg>
        <span class="sos__timer" data-timer>0:00</span>
      </span>
    </button>
    <span class="sos__say" id="sos-say" data-say aria-live="assertive"></span>

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

13 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 “SOS 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 black, a dark pill sixty pixels tall: on the left a red disc reading “SOS”, then “Hold for help”. Press and hold and the label becomes “Calling in”, on the right the count rolls 3, 2, 1, a pale ring closes around the disc and the pill tightens slightly and starts to tremble, more and more. Let go before the end and the ring unwinds, the pill springs back and says “Hold longer”: nothing was sent. Hold all the way and the red leaves the disc and floods the whole pill, the disc turns white, the label says “Calling 112” and beside it a handset draws its two waves, one after the other. After a few rings: “Help is coming” and the call time counting. One tap ends it: “Call ended”, the red goes back into the disc and it is the start again.

How it works

A single number, from 0 to 1

The ring, the count, how much the pill tightens and how much it trembles all read the same progress. Holding takes it to 1 in HOLD seconds, letting go brings it back to 0 in half a second.

The red that floods

Behind the disc sits a red circle big enough to cover the pill, at scale zero. On the call it grows from the disc’s centre, and the pill (hidden overflow) clips it to its own shape.

Press, not click

What counts is pointerdown and pointerup, with the pointer captured: if the finger slides off, the hold goes on. The same with Space and Enter held down, ignoring key repeat.

The handset’s waves

Two arcs with pathLength 1 that draw staggered and then fade, in a timeline that repeats only while it rings.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff3b30The red of the disc and of the pill when it calls.
HOLDscript.js3How many seconds it must be held before the call starts.
NUMBERscript.js112The number being called, written in the pill.
CONNECTscript.js1.6How many seconds it rings before someone answers.
LOOPscript.jstrueLeft alone, the demo’s pointer lets go too soon, then holds to the end and ends the call.

Try them in the Playground

When to use it

In the app of a personal safety service, a help line for older people, travel insurance, hikers or solo runners; on the screen of a taxi ride. The same counted hold suits any action that must not fire by mistake.

On phones

The same button, 60 pixels tall and wide enough for a thumb. The long press opens no system menu and selects no text, and the page does not scroll while holding.

With reduced motion

The ring and the count still advance, because they say how long is left; the pill neither tightens nor trembles, the red and the labels change at once, the handset’s waves are already drawn. The demo does not move by itself.

Pitfalls

  • No call is placed here: the real one is a tel: link or the app’s own service, and “Help is coming” should be written only once someone has really answered.
  • The emergency number differs by country (112 in Europe, 911 in the United States): pick it from the user’s country.
  • On iPhone a long press opens the system menu and selects text: it needs -webkit-touch-callout: none, user-select: none and touch-action: none.
  • Holding Space makes the keyboard repeat keydown: without a guard the hold would restart on every repeat.
  • If the button loses focus while the key is down, keyup never arrives: on blur the hold must be closed.

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 21 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