Skip to content
animorio
IT
All components

Find my size button

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

A cream pill button for a clothing shop: pressed, the label gives way to a yellow tailor’s tape running fast under a needle, slowing down and stopping on your centimetres with a small settle. Then the tape closes, the label says ‘Your size is’ and the size letter springs into a disc on the right.

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>
<!--
  "Find my size 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>Find my size button with the tape measure running inside the pill</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">
    <!-- a size finder button for a clothing shop: pressed, the label gives way to a tape measure that runs fast under
         a needle, slows down and stops on your chest measure; then the tape closes, the label says your size and the
         letter springs into a chip on the right; pressed again, it goes back -->
    <button class="size" type="button" data-size aria-pressed="false">
      <span class="size__glow" aria-hidden="true"></span>
      <span class="size__body" aria-hidden="true"><span class="size__light"></span></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24"><g data-ruler><rect x="2.8" y="8" width="18.4" height="8" rx="2.2"></rect><path d="M7 8v3.2M10.4 8v2M13.8 8v3.2M17.2 8v2"></path></g></svg>
      </span>

      <span class="mid">
        <span class="label"><span class="label__word" data-word>Find my size</span></span>
        <span class="tape" data-tape aria-hidden="true"><span class="tape__strip" data-strip></span><span class="tape__needle" data-needle></span></span>
      </span>

      <span class="chip" data-chip aria-hidden="true"><span data-letter>M</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.

15 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 “Find my size 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 middle, on black, a cream pill 60 pixels tall throwing a warm light on the background: on the left, in a dark round seat, a ruler drawn in line, then the label ‘Find my size’. The pointer arrives, the pill lifts by a pixel and a faint orange shade follows it; on press it squeezes and comes back on a spring. On click the label leaves upwards, the ruler in the seat turns upright and in place of the label a yellow tailor’s tape opens, with ticks and centimetre numbers, fading at both sides. The tape runs from right to left under an orange needle: very fast at first, then slower and slower, it passes 96 by a hair and comes back onto it, and the needle gives a small kick. After a moment the tape closes, the label ‘Your size is’ comes up and on the right an orange disc with the M springs in with half a spin; the light under the pill turns orange. After a few seconds, or at another click, everything goes back. Left alone, a pointer tries it again.

How it works

The tape is made by the script

For every centimetre between FROM and CHEST (plus a few at the sides) the script creates a cell 34 pixels wide with the number; its two ticks, long and short, are its ::before and ::after. The strip starts at the centre of the window, so the centimetre under the needle depends only on the shift.

The run

The strip goes from FROM’s shift to CHEST’s minus 5 pixels with power4.out in RUN seconds: it starts very fast and slows down. Then a second tween brings it onto the number with elastic.out: that is the settle.

The needle

It is a vertical line fixed at the centre; when the tape arrives it shortens to 60% and comes back on a spring, as if it felt the hit.

The size

The tape squashes and goes, the new label comes up from below and the disc on the right opens from 0 to 42 pixels while scaling and rotating by 30 degrees, all with elastic.out.

Ready again

After HOLD seconds, or at another click, the disc closes, the ruler lies down again and the strip is put back to its start for next time.

Values to change

NameFileDefaultWhat it changes
IDLEscript.jsFind my sizeThe label at rest.
FOUNDscript.jsYour size isThe label when the size is found.
LETTERscript.jsMThe size found.
CHESTscript.js96The centimetres the tape stops on.
FROMscript.js78The centimetres the tape starts from.
RUNscript.js1.7How many seconds the tape runs before stopping.
ACCENTscript.js#e5532aThe colour of the needle and the size.
HOLDscript.js2.6By itself: how many seconds the size stays before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

On the product page of a clothing shop, next to the size picker: while the site works out the size from saved measurements or past orders, the tape gives something to look at and the answer arrives as a small event. Also good for shoes, rings, bikes.

On phones

The same button: the pill takes at most the screen width minus the margins; the tape takes the label’s room, whatever it is.

With reduced motion

The tape does not run: it fades in already still on the right centimetres, then gives way to the label and the size, again with a fade.

Pitfalls

  • The tape’s strip starts at left 50%: if it started at the edge, the centimetre under the needle would change with the button’s width.
  • The tape’s numbers are centred on the tick with a CSS transform: GSAP moves only the whole strip, never the cells.
  • On a real site the size comes from the server: RUN must be tied to the response, with a minimum time so the tape is seen.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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