
The elastic button
Buttons, Hover, Text
The button of an accounting app that closes the month, on black: a graphite pill with a calendar on a light disc, «Close October» and under it a ruler of 31 thin ticks, one per day, shorter at weekends. Pressed, the days reconcile one after another in brushed brass, each with a snap and a small spring, while the ring and the counter climb; then the ticks fold into the accountant’s double rule, the disc turns to brass with a check and the pill tightens around «October closed» with a padlock.
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>
<!--
"Close month 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>The Close month button with the days reconciling</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>
<!-- one gesture: closing the books of a month in an accounting app. Under the label sits a hairline ruler with a tick
for every day of the month (weekends shorter). Pressed, the days reconcile one by one in brushed brass, then the
ticks join into the accountant's double rule and the pill closes around «October closed». Pressed again, it reopens -->
<button class="btn" type="button" data-btn aria-label="Close October, 31 days">
<span class="btn__body" data-body>
<span class="btn__glow" data-glow aria-hidden="true"></span>
<span class="btn__edge" aria-hidden="true"></span>
<span class="btn__sheen" data-sheen aria-hidden="true"></span>
<span class="icon" data-icon aria-hidden="true">
<span class="icon__disc"></span>
<span class="icon__disc icon__disc--done" data-disc-done></span>
<svg class="icon__svg" viewBox="0 0 40 40">
<circle class="ring__track" data-track cx="20" cy="20" r="18.25"></circle>
<circle class="ring__fill" data-ring cx="20" cy="20" r="18.25"></circle>
<g data-cal>
<rect class="icon__line" x="13" y="14" width="14" height="13" rx="2.6"></rect>
<path class="icon__line" d="M13 18.6h14"></path>
<path class="icon__line" d="M16.6 12v3.6M23.4 12v3.6"></path>
<path class="icon__dot" d="M16.6 22.4h1.6M19.2 22.4h1.6M21.8 22.4h1.6"></path>
</g>
<path class="icon__line icon__check" data-check d="M14.2 20.6l3.9 3.9 7.8-8.4"></path>
</svg>
</span>
<span class="txt txt--rest" data-rest>
<span class="txt__main" data-rest-main>Close October</span>
<span class="txt__meta" data-rest-meta>31 days</span>
</span>
<span class="txt txt--run" data-run>
<span class="txt__main">Reconciling</span>
<span class="txt__meta"><span class="count" data-count>0</span> of <span data-total>31</span></span>
</span>
<span class="txt txt--done" data-done>
<span class="txt__main" data-done-main>October closed</span>
<span class="txt__meta lockrow">
<svg class="lock" viewBox="0 0 16 16" aria-hidden="true">
<path class="lock__shackle" d="M5.2 7.2V5.4a2.8 2.8 0 0 1 5.6 0v1.8"></path>
<rect class="lock__body" x="3.6" y="7.2" width="8.8" height="6.4" rx="1.6"></rect>
</svg>
<span class="swap"><span class="swap__a">Locked</span><span class="swap__b">Reopen</span></span>
</span>
</span>
<span class="ticks" data-ticks aria-hidden="true"></span>
<span class="rule" data-rule aria-hidden="true"><span class="rule__line" data-rule-a></span><span class="rule__line" data-rule-b></span></span>
</span>
</button>
<span class="sr" aria-live="polite" data-live></span>
<svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true">
<path d="M5 3.2 18.6 13l-6.1.9 3.6 6.6-2.6 1.4-3.6-6.6L5.3 19.6z"></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.
27 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 “Close month button” from Animorio and fit it into my siteThe script creates one tick per day inside a flex container with space-between, so the ruler fits any width without pixel sizes. The weekday comes from PRIMO: Saturdays and Sundays get the short tick class. Each tick holds an unlit brass layer that lights up with opacity.
One gsap.quickTo per tick on scaleY with elastic.out: on every pointermove the height is 1 + 0.7 times a gaussian of the distance from the pointer, so a small wave rises under the finger and falls back by itself.
Day i starts at DURATA times (1 − cos(π · i / N)) / 2: slow at first, fast in the middle, slow at the end, like a work queue. Each tick has two keyframes, scaleY up to SCATTO in 90 ms and back with elastic.out; the counter, the ring (strokeDashoffset) and the warm light (a CSS variable on the gradient) follow the same progress.
The final width is measured on the «October closed» label with the padlock (already in the DOM, hidden): GSAP animates the button width with elastic.out and MOLLA, and recomputes it on resize. The double rule is two one-pixel lines with scaleX from the left, the second 80 ms later.
The state lives in one variable: at rest a click closes, during the count it cancels (the timeline stops and the ticks go dark from the right), when closed it reopens. The Locked/Reopen swap is CSS only, on hover, on keyboard focus and on the is-near class the drawn pointer uses.
| Name | File | Default | What it changes |
|---|---|---|---|
MESE | script.js | October | The month to close, in the button labels. |
GIORNI | script.js | 31 | How many days the month has: one tick per day. |
PRIMO | script.js | 4 | Which weekday the first of the month is (1 Monday, 7 Sunday): Saturdays and Sundays get the shorter tick. |
DURATA | script.js | 2.6 | How long reconciling all the days takes, in seconds. |
SCATTO | script.js | 1.8 | How far each tick stretches when its day balances (1 = not at all). |
MOLLA | script.js | 0.55 | How soft the spring of the closing pill is (lower bounces more). |
ATTESA | script.js | 2.4 | How long it stays closed before the drawn pointer reopens it, in seconds. |
For the month-end close of an accounting or invoicing app, in the panel of a business expenses app, in payroll, in closing a sprint or a period in a productivity app: anywhere an action closes and locks a period after a check.
The same 60-pixel pill, 88 per cent of the screen wide up to 320 pixels: the ticks spread over the width by themselves. A tap closes the month, a tap halfway cancels and a tap on the closed pill reopens it; without hover, Reopen shows on focus.
No snaps, springs or reflections: the labels fade, the ticks turn brass one after another in colour only, the ring fills and at the end the pill fades to the size of October closed with the check and the double rule already drawn. The drawn pointer is hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.5 KB; the libraries: GSAP 28 KB.
Tested on 10 November 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.