Skip to content
animorio
IT
All components

Alarm dial picker

Pickers, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.4 KBGSAP 28 KBFreeDownload the zip

The alarm card of a made-up sleep app, on white: a dial with an orange hand to drag. You pick the hour, the dial hands over to the minutes by itself, swapping the numbers around it, the digits on top roll, the ticks near the hand lift and «Set alarm» becomes «Alarm set» with a check drawing itself.

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>
<!--
  "Alarm dial picker" 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 alarm time picker on a dial</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 alarm card of a made-up sleep app: drag the hand round the dial to pick the hour, it hands over to the
         minutes by itself, and Set alarm folds the choice into a confirmation -->
    <section class="card" data-card aria-label="Alarm">
      <header class="top">
        <p class="brand">
          <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 16.5h16"></path><path d="M7.5 16.5a4.5 4.5 0 0 1 9 0"></path><path d="M12 6.2v2.2M6.6 9.1l1.4 1.4M17.4 9.1 16 10.5"></path></svg>
          <span>Dawnly</span>
        </p>
        <div class="ampm" role="radiogroup" aria-label="Morning or evening" data-ampm>
          <span class="ampm__pill" data-ampm-pill aria-hidden="true"></span>
          <button class="ampm__opt" type="button" role="radio" aria-checked="true" data-half="am">AM</button>
          <button class="ampm__opt" type="button" role="radio" aria-checked="false" data-half="pm">PM</button>
        </div>
      </header>

      <div class="time" aria-live="polite">
        <button class="time__part" type="button" data-part="h" aria-label="Hours">
          <span class="digit"><span class="digit__roll" data-d="h0"></span></span><span class="digit"><span class="digit__roll" data-d="h1"></span></span>
        </button>
        <span class="time__colon" aria-hidden="true">:</span>
        <button class="time__part" type="button" data-part="m" aria-label="Minutes">
          <span class="digit"><span class="digit__roll" data-d="m0"></span></span><span class="digit"><span class="digit__roll" data-d="m1"></span></span>
        </button>
      </div>
      <p class="sub"><span class="sub__line" data-sub>Rings in 6 h 42 min</span></p>

      <div class="dial" data-dial>
        <svg class="dial__svg" viewBox="0 0 200 200" aria-hidden="true">
          <circle class="dial__face" cx="100" cy="100" r="96"></circle>
          <g data-ticks></g>
          <g class="dial__labels" data-labels-a></g>
          <g class="dial__labels" data-labels-b></g>
          <g data-hand>
            <line class="hand__line" x1="100" y1="100" x2="100" y2="30" data-hand-line></line>
          </g>
          <circle class="hand__pivot" cx="100" cy="100" r="3.4"></circle>
          <g data-knob-pos>
            <g data-knob>
              <circle class="knob" cx="0" cy="0" r="14"></circle>
              <circle class="knob__ring" cx="0" cy="0" r="14"></circle>
            </g>
          </g>
          <g data-knob-text-pos><g data-knob-text></g></g>
        </svg>
        <div class="dial__hit" data-hit role="slider" tabindex="0" aria-label="Hour" aria-valuemin="1" aria-valuemax="12" aria-valuenow="6"></div>
      </div>

      <button class="set" type="button" data-set data-autoclic>
        <span class="set__label" data-set-label>Set alarm</span>
        <span class="set__done" data-set-done aria-hidden="true">
          <svg viewBox="0 0 24 24"><path class="set__check" data-check d="M6 12.4 10.2 16.4 18 8.2"></path></svg>
          <span>Alarm set</span>
        </span>
      </button>
    </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.

21 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 “Alarm dial picker” 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 white background there is the card of Dawnly, a made-up sleep app: at the top the logo with a rising sun and an AM and PM switch with a white pill, below it the time in large digits, 06:00, and the line «Rings in 6 h 42 min», counted from a made-up now, 23:18. Then a very light grey dial with sixty ticks and the hour numbers, and an orange hand with a round knob that carries the chosen value. You grab the knob and drag it: the hand follows your finger, the nearby ticks lift and take on colour, the digits on top roll and the «Rings in» line updates. Let go, the hand snaps to the hour on a spring that goes a hair too far and back, and after a moment the dial hands over to the minutes: the hour numbers leave one after another starting from the one by the hand, and 00, 05, 10 and the rest come in, always after, never on top of each other. The knob swells when you grab it and comes back with a small bounce. «Set alarm» presses in, the label rises away, «Alarm set» arrives with a check drawing itself and a ring spreads out from the knob and fades; shortly after, the button goes back to how it was. A drawn pointer does the round by itself, from 6:00 to 7:30, and stops at the first real touch.

How it works

The dial in SVG

A 200 by 200 viewBox: sixty ticks as lines, two groups of twelve numbers (hours and minutes) on the same circle of radius 74, the hand that GSAP rotates around the centre with svgOrigin and the knob moved by hand with a translate, so its number stays upright.

The angle from the pointer

The pointer’s position relative to the dial’s centre gives the angle with atan2; the value is the angle divided by 30 for hours or 6 for minutes, rounded to the step. The hand chases the raw angle with a 0.14-second tween and, on release, goes to the value with back.out: always the shortest way, so it never goes all the way round through zero.

The ticks that lift

On every frame each tick measures its distance from the hand: within 15 degrees it grows towards the centre on a soft curve and takes on the orange with color-mix, so a small wave follows the hand around.

Hours and minutes without overlapping

Moving to the minutes, the hour numbers leave in 0.16 seconds with a delay that grows away from the hand, and the minute numbers only come in after 0.2 seconds, in the same order: there are never two readable numbers in the same place.

The digits and the confirmation

Each digit is a column from 0 to 9 in a window one line tall, moved with yPercent ten per unit and back.out. In «Set alarm» the label rises away before «Alarm set» arrives, the check draws itself with strokeDashoffset and a delayedCall puts the button back.

Values to change

NameFileDefaultWhat it changes
SNAPscript.js0.5How long the spring that snaps the hand to the hour or minute lasts, in seconds.
MINUTE_STEPscript.js5How many minutes the minute hand jumps by: 1, 5, 10 or 15.
HANDOVERscript.js0.35How many seconds after letting go of the hour the dial moves to the minutes.
HOLDscript.js2.4How many seconds «Alarm set» stays before going back to «Set alarm».
LIFTscript.js5How many points the ticks near the hand lift by.
NOWscript.js"23:18"The made-up current time «Rings in» counts from.
ACCENTscript.js"#ff6a2b"The colour of the hand, the knob and the sun in the logo.

Try them in the Playground

When to use it

For picking a time in an app: the alarm in a sleep or wellness app, a reminder, a pickup or delivery time, an appointment. It works well with a finger, where a list of times would be long to scroll.

On phones

The dial is sized on both height and width (at most 232 pixels, 64% of the width, 40% of the height) and the card never goes past the width minus the margins; on the dial the finger drags without scrolling the page (touch-action: none).

With reduced motion

The hand goes to its place without a spring, the digits change without rolling, the hour and minute numbers swap with a fade, the confirmation fades in with the check already drawn and the drawn pointer is hidden.

Pitfalls

  • The hand must take the shortest way: from 11 to 12 the angle goes from 330 to 0, and a direct tween would go the long way round. The angle is kept continuous and the nearest equivalent is chosen.
  • The number in the knob sits in a group that is moved, not rotated: rotated with the hand it would end up upside down.
  • While dragging, the «Rings in» line changes without animation: with its animation on every hour there would be two half-visible lines.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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