Skip to content
animorio
IT
All components

Close month button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.5 KBGSAP 28 KBFreeDownload the zip

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.

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>
<!--
  "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>

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.

27 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 “Close month 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 sits a 60-pixel graphite pill with a one-pixel edge that catches light where the pointer passes. On the left a light disc with a calendar, next to it «Close October» and on the right «31 days»; under the label runs a ruler of 31 thin ticks, one per day of the month, with Saturdays and Sundays shorter. Hovering, the ticks near the pointer lift a little on a spring. Pressed, the pill squashes and comes back, the label slides away and «Reconciling» arrives with the counter «0 of 31»; the days light up one after another in brushed brass, slow at first, fast in the middle and slow again at the end, and each one stretches past its height and settles with a small spring, while a warm light follows them underneath and the ring around the disc fills. At the end the ticks drop from right to left, the calendar shrinks away, the disc turns to brass with a drawn check, the pill tightens on a spring around «October closed» with the padlock and «Locked», the two thin rules of a closed total draw underneath and a reflection crosses the pill. Coming near again the padlock opens and «Locked» rolls to «Reopen»: a tap reopens the month and the ruler comes back. A tap halfway cancels the reconciliation. The drawn pointer does it all by itself and stops at the first touch.

How it works

The ruler of days

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

Ticks that lift on hover

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.

Reconciling at the pace of a real job

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 pill closing on its label

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.

Reopen and cancel

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.

Values to change

NameFileDefaultWhat it changes
MESEscript.jsOctoberThe month to close, in the button labels.
GIORNIscript.js31How many days the month has: one tick per day.
PRIMOscript.js4Which weekday the first of the month is (1 Monday, 7 Sunday): Saturdays and Sundays get the shorter tick.
DURATAscript.js2.6How long reconciling all the days takes, in seconds.
SCATTOscript.js1.8How far each tick stretches when its day balances (1 = not at all).
MOLLAscript.js0.55How soft the spring of the closing pill is (lower bounces more).
ATTESAscript.js2.4How long it stays closed before the drawn pointer reopens it, in seconds.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The closed pill’s width is measured on the hidden label: with display none it would be zero, so the labels are hidden with visibility (autoAlpha) and stay in the layout.
  • The ticks have two animations on scaleY, the hover wave (quickTo) and the reconciliation snap: on click the wave goes back to 1 and during the count pointermove no longer touches it, otherwise the two tweens fight over the same property.
  • On a phone there is no hover: the Locked/Reopen swap also lives on a class, which the drawn pointer turns on, and on keyboard focus.

Libraries

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.

Testing

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