
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteA 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 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.
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.
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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
SNAP | script.js | 0.5 | How long the spring that snaps the hand to the hour or minute lasts, in seconds. |
MINUTE_STEP | script.js | 5 | How many minutes the minute hand jumps by: 1, 5, 10 or 15. |
HANDOVER | script.js | 0.35 | How many seconds after letting go of the hour the dial moves to the minutes. |
HOLD | script.js | 2.4 | How many seconds «Alarm set» stays before going back to «Set alarm». |
LIFT | script.js | 5 | How many points the ticks near the hand lift by. |
NOW | script.js | "23:18" | The made-up current time «Rings in» counts from. |
ACCENT | script.js | "#ff6a2b" | The colour of the hand, the knob and the sun in the logo. |
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.
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).
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.
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.
Tested on 30 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.