Skip to content
animorio
IT
All components

Age gate

Consent, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.8 KBGSAP 28 KBFreeDownload the zip

The question an online wine shop asks before letting you in: “Are you 18 or older?”. Pick the country and the legal age changes, 18, 21 or 20, the number rolling everywhere while the dial of ticks clicks round once per year. On yes the ring closes into a tick and the card folds; on no it shuts politely and leaves a way back.

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>
<!--
  "Age gate" 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>Age gate</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">
    <!-- an age gate for a wine shop: the country sets the legal age (the number rolls and the dial clicks round),
         Yes closes the ring into a tick and folds the card, No folds it shut with a way back -->
    <section class="ag" data-ag aria-labelledby="ag-title">
      <div class="ag__seal" data-seal aria-hidden="true">
        <span class="ag__ripple" data-ripple></span>
        <svg viewBox="0 0 80 80">
          <g data-dial><circle class="ag__dial" cx="40" cy="40" r="38" pathLength="60"></circle></g>
          <circle class="ag__track" cx="40" cy="40" r="31.500"></circle>
          <circle class="ag__ring" data-ring cx="40" cy="40" r="31.500" pathLength="1" transform="rotate(-90 40 40)"></circle>
          <path class="ag__tick" data-tick pathLength="1" d="M28.500 41l8 8.500L52 32"></path>
        </svg>
        <span class="ag__num" data-num><span class="ag__roll"><span data-n>18</span></span><i>+</i></span>
      </div>

      <h2 class="ag__title" id="ag-title"><span data-title>Are you <span class="ag__roll ag__roll--in"><span data-n>18</span></span> or older?</span></h2>
      <p class="ag__sub"><span data-sub>Legal drinking age where you are</span></p>

      <div class="ag__fold" data-body>
        <div class="ag__seg" data-seg role="radiogroup" aria-label="Country">
          <span class="ag__thumb" data-thumb aria-hidden="true"></span>
          <button type="button" role="radio" aria-checked="true" data-place="0">Italy</button>
          <button type="button" role="radio" aria-checked="false" tabindex="-1" data-place="1">USA</button>
          <button type="button" role="radio" aria-checked="false" tabindex="-1" data-place="2">Japan</button>
        </div>
        <div class="ag__row">
          <button class="ag__no" type="button" data-no><span class="ag__press">No</span></button>
          <button class="ag__yes" type="button" data-yes><span class="ag__press">Yes, I’m <span class="ag__roll ag__roll--in"><span data-n>18</span></span>+</span></button>
        </div>
      </div>

      <div class="ag__fold ag__fold--shut" data-after>
        <button class="ag__back" type="button" data-back tabindex="-1">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6.500 3.500 3 7l3.500 3.500M3.500 7H10a3 3 0 0 1 0 6H8"></path></svg>
          <span data-backlabel>Start over</span>
        </button>
      </div>

      <span class="ag__say" data-say aria-live="polite"></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

24 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Age gate” 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 white, a light rounded card. At the top a seal: a dial of sixty thin ticks, a ring and inside it the number “18+”. Below, the question “Are you 18 or older?”, a three-country selector with a white thumb that slides (Italy, USA, Japan) and two buttons: “No” and, in burgundy, “Yes, I’m 18+”. Change country and the age becomes 21 or 20, rolling at once in the seal, in the question and in the button, upwards if it rises and downwards if it falls; the dial turns six degrees per year and settles on a spring. On yes the ring closes all the way round, the number gives way to a tick that draws itself, a thin circle widens once and is gone; the question becomes “Welcome in”, the line below says how many days it is remembered, the selector and buttons fold away and the card shortens with a bounce. On no the number shakes its head once and dims, the card says “Not just yet” and how old you need to be in that country. Either way a small button is left to go back to the question.

How it works

One age, three places

The number lives in three elements sharing one attribute: in the seal, in the question and in the button. Change country and they all roll together, the direction telling whether the age went up or down.

The dial that clicks

Sixty ticks made from a single dashed circle (pathLength 60). The rotation is an animated number written into the transform attribute: six degrees per year, with a spring to settle it.

Two folds

What you answer with and what is left afterwards are two blocks with an animated height: one closes while the other opens, and the card follows their sizes with no fixed heights.

The ring and the tick

Ring and tick have pathLength 1 and draw with stroke-dashoffset; GSAP’s automatic rounding is switched off, or they would simply pop in.

For keyboard users

The countries are a radiogroup driven by the arrow keys; the buttons of the closed fold leave the Tab order, focus moves to the button that remains and an aria-live region says every answer.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#8a2846The colour of the yes, the ring and the tick.
STARTscript.js0The country chosen at the start: 0 = Italy, 1 = USA, 2 = Japan.
DAYSscript.js30How many days the yes is remembered: the line after verification says so.
SPRINGscript.js1How elastic the card, the country thumb and the dial are: 0.3 = stiff, 2 = very elastic.
LOOPscript.jstrueLeft alone, the demo’s pointer changes country, says yes, starts over and says no.

Try them in the Playground

When to use it

At the door of an online wine shop, a brewery, a distillery, a cigar store or any site reserved for adults; also on a bar or restaurant site with a wine list you can order from.

On phones

The same card, as wide as the screen minus the margins: buttons 48 pixels tall, the country selector fits on one row and everything stays inside the preview box.

With reduced motion

Numbers, lines and folds change at once, the dial does not turn, the ring and tick appear already drawn. The demo does not move by itself.

Pitfalls

  • Legal ages differ by country (here Italy 18, United States 21, Japan 20) and in some countries by type of drink: check them for every market you sell in. A yes-or-no question is not identity verification.
  • The yes must really be remembered (a cookie or localStorage with an expiry), or the question comes back on every page; the start-over button is there for the demo.
  • A fold with hidden overflow clips the buttons’ focus ring: four pixels of padding inside and as many of negative margin outside.
  • The country thumb is measured on the chosen button: put it back in place on resize and when the font arrives.
  • Rotating an SVG group with transformOrigin spins it around its bounding box: the rotation is written into the transform attribute with the viewBox centre.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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