Skip to content
animorio
IT
All components

Snooze button

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

The Snooze button of a made-up alarm app, Lull: the alarm rings at 7:00 and the pill is amber. Pressed, it squashes on a spring, the time rolls digit by digit to 7:09, the pill turns graphite and a thin nine-minute ring is drawn inside and starts running out, while a small drawn z rises just once. Another Snooze adds nine minutes (7:18) and the ring fills back up; when it runs out the alarm rings again. Stop sets everything back to 7:00. Minimal style, on black.

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>
<!--
  "Snooze 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>Snooze 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 Snooze button of a made-up alarm app, Lull: the alarm is ringing at 7:00. Snooze rolls the time to 7:09,
         a thin ring of nine minutes starts to run out inside the pill and a small z rises once. Snooze again adds
         nine more (7:18) and the ring grows back. When it runs out, the alarm rings again. Stop sets it all back. -->
    <div class="alarm" data-wrap>
      <div class="clock" aria-hidden="true">
        <span class="clock__sub"><span class="roll" data-subroll><span>Ringing · Weekdays</span><span>Next ring</span><span>Ringing again</span></span></span>
        <span class="clock__time" data-time></span>
      </div>

      <div class="row">
        <button class="pill" type="button" data-snooze data-autoclic aria-describedby="lull-live">
          <span class="pill__bg" data-bg aria-hidden="true"></span>
          <span class="pill__dark" data-dark aria-hidden="true"></span>
          <span class="pill__gloss" aria-hidden="true"></span>
          <span class="pill__ring" aria-hidden="true">
            <svg viewBox="0 0 24 24" data-ringsvg>
              <circle class="ring__track" cx="12" cy="12" r="9"></circle>
              <circle class="ring__run" data-run cx="12" cy="12" r="9" pathLength="1" transform="rotate(-90 12 12)"></circle>
              <path class="ring__bell" data-bell d="M8.6 14.6h6.8l-.9-1.3v-2.6a2.5 2.5 0 0 0-5 0v2.6Z M11 16.3a1 1 0 0 0 2 0"></path>
            </svg>
            <svg class="zed" viewBox="0 0 10 12" data-zed><path d="M2 2.5h6L2 9.5h6" pathLength="1"></path></svg>
          </span>
          <span class="pill__text">
            <span class="roll" data-labelroll><span>Snooze</span><span>Snoozed · <b data-mins>9</b> min</span></span>
          </span>
        </button>
        <button class="stop" type="button" data-stop>Stop</button>
      </div>
      <p class="sr" id="lull-live" aria-live="polite" data-live>Alarm ringing, 7:00.</p>
    </div>
  </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.

24 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 “Snooze 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 black background, at the top the small line «Ringing · Weekdays» and the big alarm time, 7:00; below it the amber «Snooze» pill with a small bell drawn in line, and next to it «Stop», just a thin outline. With the pointer over the pill the label widens on the font’s width axis and the background swells with a bounce; pressed, it squashes. On click the time rolls like a flip clock, right digit first, to 7:09; the pill fades to graphite, the bell goes and a thin amber ring is drawn in its place and starts running out at once; the label rolls to «Snoozed · 9 min» and the minutes count down by themselves; a small z is drawn in one stroke and rises as it fades, just once. Above the time, the small line becomes «Next ring». Pressing again adds nine minutes: the time rolls to 7:18, the ring fills back up and the minutes go up. When the ring runs out the pill turns amber again, the bell comes back and swings, the pill shakes twice and above it reads «Ringing again». Stop rolls the time back to 7:00 and everything as it was. Past 7:54 the pill shakes its head.

How it works

The flip clock time

Each digit of the time sits in a 1em window holding a strip from 0 to 9: GSAP moves the strip by -10% per unit (yPercent), with power3.inOut, and the digits start from the right, 0.07 seconds apart. Digits that don’t change stay still.

The ring that runs out

An SVG circle with pathLength=1 and stroke-dasharray 1 1, turned -90 degrees once and for all with the transform attribute: nothing spins, only stroke-dashoffset changes. GSAP’s ticker takes dt/MINUTE off the minutes left and the ring is 1 − left/total. A new Snooze adds nine minutes, the total becomes the minutes left and the ring fills back up in 0.6 seconds.

The elastic pill

The amber and graphite grounds are two layers under the label: GSAP scales only them (1.04 on hover with an elastic, 0.95 by 0.9 when pressed), so the label never wobbles. The label’s width is a CSS variable, --w, inside font-variation-settings, moved with quickTo.

From night to morning

On Snooze the graphite layer goes to opacity 1 and the colour of the text and ring turns amber; when the minutes run out it goes back to amber, the bell swings around its hook with svgOrigin and the pill shakes with x keyframes.

The z

A z drawn in a single stroke: stroke-dashoffset from 1 to 0 in 0.35 seconds while it rises 22 pixels and fades. With autoRound off, so GSAP doesn’t round the stroke to 0 or 1.

Values to change

NameFileDefaultWhat it changes
STARTscript.js7The alarm hour
SNOOZEscript.js9The minutes of each Snooze
MINUTEscript.js0.45How many seconds a minute lasts in the demo
ROLLscript.js0.55The seconds of the rolling digits
SPRINGscript.js1How much the pill bounces
WIDENscript.js112The label width on hover
IDLEscript.js1.2Seconds before the demo starts by itself

Try them in the Playground

When to use it

In an alarm or timer app, a morning weather or calendar widget, any reminder that can be put off.

On phones

Same animations; on touch there is no hover widening, the press is there. Sizes scale with the screen and the row fits in 341 pixels.

With reduced motion

No rolling digits, no z, no shaking: time and labels change in place with a fade, colours cross-fade and the ring still runs out.

Pitfalls

  • The ring must not spin: the -90 degrees go in the circle’s transform attribute, once, and only stroke-dashoffset is animated.
  • The swelling ground is a separate layer: scaling the whole button made the label wobble with it.
  • Past 7:59 the hour would become 8: the pill refuses a Snooze that would cross the hour.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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