Skip to content
animorio
IT
All components

Clock in button

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

The attendance button in a team’s app: a light pill with a clock and the shift’s start time. Pressed, a green tint leaves the clock and floods the pill, the hands take a run-up and start to run, the ring around them follows the shift and the tag counts the time worked. Pressed again it clocks out: the hands close into a tick and the label says how many hours were logged.

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>
<!--
  "Clock in 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>Clock in button with the shift that starts counting</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 clock-in button of a team app: pressed, a green wash leaves the clock, its hands start to run, the ring
         around it follows the shift and the tag on the right counts the time worked; pressed again it clocks out,
         a tick draws itself in the clock and the label says how much was logged -->
    <button class="ck" type="button" data-ck aria-pressed="false">
      <span class="ck__body" aria-hidden="true"><span class="ck__wash" data-wash></span><span class="ck__light"></span></span>
      <span class="ck__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <circle class="seat__track" cx="12" cy="12" r="10.2"></circle>
          <circle class="seat__ring" data-ring cx="12" cy="12" r="10.2" pathLength="1" transform="rotate(-90 12 12)"></circle>
          <g data-hands>
            <path class="seat__hand" data-hh d="M12 12V7.6"></path>
            <path class="seat__hand seat__hand--min" data-mm d="M12 12V5.2"></path>
          </g>
          <path class="seat__tick" data-tick pathLength="1" d="M8.2 12.4 10.9 15 15.9 9.4"></path>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Clock in</span></span>
        <span class="label__sub"><span data-sub>Shift starts 9:00</span></span>
      </span>
      <span class="tag" aria-hidden="true"><span data-time>0:00</span></span>
    </button>
    <p class="sr" data-live aria-live="polite"></p>

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

16 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 “Clock in 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

In the centre, on black, a light pill 60 pixels tall whose edge catches the light: on the left, in a white seat, a clock drawn in outline and stopped at the shift’s start time, then two lines (“Clock in” and below “Shift starts 9:00”) and on the right a tag with 0:00. Pressed, a green tint leaves the clock and spreads over the whole pill, the clock leans back a few degrees and lets go, the hands start to run, a green ring advances around the dial and the tag counts the minutes worked; the labels roll to “Clock out” and “On shift since 9:00”. Pressed again, the hands close, the ring completes, a tick draws itself in the centre, everything turns blue and the label says “46m logged”, with “Saved to your timesheet” below. After a couple of seconds it goes back, the hands rewinding to 9.

How it works

One number only

The minutes worked are one number that a linear tween takes from 0 to the shift’s length. At each step the same function turns the minute hand (6 degrees per minute) and the hour hand (half a degree), shortens the ring’s stroke-dashoffset and rewrites the tag: clock, ring and count cannot say three different things.

The tint from the clock

Inside the pill there is a coloured layer clipped with clip-path: circle() centred on the clock. On clocking in the radius goes from 0 to 360 pixels with power3.out, so the colour seems to come out of the dial.

Clocking out

The minutes tween stops where it is, the hands scale to zero, the ring runs to close, the tick draws itself with stroke-dashoffset and the label is composed from the minutes (hours and minutes). On the way back the same number returns to 0 with power3.inOut, and the hands rewind by themselves.

Values to change

NameFileDefaultWhat it changes
STARTscript.js9:00The shift’s start time: the hands start from here.
SHIFTscript.js8How many hours the shift lasts: when it ends the ring is closed.
SPEEDscript.js10How many shift minutes pass in one second (1/60 is real time).
ACCENTscript.js#12a868The colour while the shift is running.
DONEscript.js#4f5dffThe colour once the shift is closed.
RUNscript.js4.6On its own: after how many seconds it clocks out.
HOLDscript.js2.4On its own: how many seconds the summary stays before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

For the attendance app of a team, a shop, a restaurant or a building site, and for whoever tracks hours on a project. In a real product SPEED is 1/60 (real time), the start time is the moment of clocking in and the button stays on “Clock out” for as long as the shift is open.

On phones

The same button: the pill takes at most the screen width minus the margins; it is pressed with a finger and there is no light under the pointer.

With reduced motion

No spreading tint, run-up or bounces: the colour fades in, the hands and the count still advance (they are the information), labels and tick change with a fade.

Pitfalls

  • The hands rotate with svgOrigin at the centre of the viewBox (12 12): with a percentage transform-origin they would turn around the centre of their own outline, that is halfway along the hand.
  • The tag is rewritten only when the whole minute changes, not on every frame: sixty writes a second of the same text are wasted work.
  • The button has aria-pressed and a line for screen readers says when you clocked in and how much was logged: colour alone is not enough.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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