Skip to content
animorio
IT
All components

Yoga class booking button

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

The button that books a class in a yoga studio. On the right it says how many spots are left; pressed, the rolled mat in the disc unrolls all the way, the tick draws itself above it, the texts say class and time and the spots go down by one.

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>
<!--
  "Yoga class booking 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>Book class button of a yoga studio with the mat that unrolls and the spots that go down</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 button that books a class in a yoga studio: pressed, the rolled mat unrolls across the disc, the spots
         left go down by one, a tick draws itself above the mat and the tag says the mat is yours -->
    <button class="yg" type="button" data-yg>
      <span class="yg__body" aria-hidden="true"><span class="yg__wash" data-wash></span><span class="yg__light"></span></span>
      <span class="yg__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <path class="seat__floor" d="M4.500 18.600h15"></path>
          <path class="seat__mat" data-mat pathLength="1" d="M5.200 16.800h13.600"></path>
          <g data-roll><circle class="seat__roll" cx="0" cy="0" r="4.400"></circle><path class="seat__spiral" data-spiral d="M0 0a1.500 1.500 0 1 1 1.500 1.500a2.600 2.600 0 0 1-2.600-2.600"></path></g>
          <path class="seat__tick" data-tick pathLength="1" d="M8.200 9.400 10.900 12 15.900 6.500"></path>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Book class</span></span>
        <span class="label__sub"><span data-sub>Vinyasa flow</span></span>
      </span>
      <span class="tag" aria-hidden="true"><span data-left>3 left</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 “Yoga class booking 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, a light pill 60 pixels high: on the left a white disc with a rolled mat, in the middle “Book class” and below it the class name, on the right a tag with “3 left”. On hover the light follows the pointer and the roll opens by a finger. Pressed: a sage green tint leaves the disc, the roll backs up slightly, then runs to the right spinning and getting thinner while the mat lies down behind it, and the texts roll to the time. With the mat flat the disc bounces, the mat lifts a hair and settles, the tick draws itself above it, the text becomes “You’re in” and the tag goes to “2 left”. After a few seconds the mat rolls itself up again.

How it works

One number for the mat

A value from 0 to 1 does everything: the roll’s position, its radius (from 4.4 to 1.2), the rotation of a turn and a half and the stroke of the mat behind it (stroke-dashoffset with pathLength 1).

The run-up

First the value goes to minus 0.04 in 0.14 seconds, like a hand resting on the roll, then to 1 with power3.out: it starts fast and slows at the end, with no bounce.

The confirmation

The mat rises by 0.7 units and comes back with back.out(3), the tick draws itself in 0.36 seconds, the tag rolls to one spot fewer. With SPOTS at zero the button says “Class full” and does not answer.

Values to change

NameFileDefaultWhat it changes
CLASSscript.js"Vinyasa flow"The class to book (made up).
WHENscript.js"Today, 6:30 pm"When it starts (made up).
SPOTSscript.js3How many spots are left before booking.
UNROLLscript.js0.9How many seconds the mat takes to unroll.
ACCENTscript.js#7fae8bThe colour of the mat.
OKscript.js#2f9d6aThe colour once the class is booked.
HOLDscript.js2.6Alone: how many seconds the confirmation stays before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

On the site of a yoga or pilates studio, in a gym’s class timetable, in a class booking app. In a real product the spots come from the calendar.

On phones

The same pill, at most as wide as the screen minus the margins; there is no hover, the tap does the same job.

With reduced motion

The mat does not unroll: it appears already flat, the texts change without rolling and the tick appears.

Pitfalls

  • The roll has position, scale and rotation written by a single function: three separate tweens would drift apart on the way back.
  • autoRound is off at the top of the script: with pathLength 1 GSAP would draw the mat all at once.
  • The tick has opacity 0 at rest: a zero-length stroke with round caps would leave a dot.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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