Skip to content
animorio
IT
All components

Pay for parking button

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

A parking meter in a single pill: minus and plus set the minutes, the dial with the P fills on a spring, the end time and the price update. Pressing Pay, green opens from the middle of the button, the dial changes colour and the time starts running down.

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>
<!--
  "Pay for parking 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>Pay for parking button</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 parking meter in one pill: minus and plus set the minutes, the dial and the price follow,
         Pay turns the dial green and the time starts running down -->
    <div class="pk" data-pk role="group" aria-label="Pay for parking">
      <span class="pk__dial" aria-hidden="true">
        <svg viewBox="0 0 46 46">
          <circle class="pk__track" cx="23" cy="23" r="19"></circle>
          <circle class="pk__arc" data-arc cx="23" cy="23" r="19" pathLength="1" transform="rotate(-90 23 23)"></circle>
          <path class="pk__p" data-p d="M19.500 30V16.500h4.300a4 4 0 0 1 0 8h-4.300"></path>
        </svg>
      </span>

      <button class="pk__step" type="button" data-minus aria-label="15 minutes less">
        <svg viewBox="0 0 14 14" aria-hidden="true"><path d="M3 7h8"></path></svg>
      </button>
      <span class="pk__mid" aria-live="polite">
        <b class="pk__roll pk__dur"><span data-dur></span></b>
        <span class="pk__roll pk__until"><span data-until></span></span>
      </span>
      <button class="pk__step" type="button" data-plus aria-label="15 minutes more">
        <svg viewBox="0 0 14 14" aria-hidden="true"><path d="M3 7h8M7 3v8"></path></svg>
      </button>

      <button class="pk__pay" type="button" data-pay>
        <span class="pk__wash" data-wash aria-hidden="true"></span>
        <svg class="pk__tick" viewBox="0 0 16 16" aria-hidden="true"><path data-tick pathLength="1" d="M3.500 8.300 6.700 11.300 12.700 4.800"></path></svg>
        <span class="pk__roll pk__label"><span data-label></span></span>
      </button>
    </div>

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

12 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 “Pay for parking 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 white, a light pill: on the left a round dial with the parking P and a blue arc, then the minus, the duration with the end time under it, the plus, and on the right the black “Pay” button with the price. At first the arc winds up to the chosen minutes and the price counts. Each tap on plus or minus changes the duration by a quarter of an hour: the arc grows or shrinks on a spring, duration and end time roll in the direction of the change, the price counts without overshooting and the pressed key bounces; at the limits the key goes dim. Pressing “Pay”, green opens in a circle from the middle of the button, which reads “Paid” with a drawn check; the dial gives a small jump, the P nods, everything turns from blue to green and in place of the duration the time left starts running, to the second, with the arc falling. After a few seconds it is ready to pay again.

How it works

The dial is a share

The arc is a circle with pathLength 1 and a stroke-dasharray equal to the minutes over the longest stay. Choosing, the share goes to its new value with back.out; once paid, the same share falls with the time left.

The price without a spring

The arc bounces, the price does not: it counts with power2.out up to its value and stops, because a figure that overshoots and comes back looks like a mistake.

One colour for the whole pill

Arc, P and shadow read --tone: GSAP animates the variable from blue to green and the meter changes state all at once, while the button’s green is a circle clip-path.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2f6bffThe meter’s colour while choosing.
PAIDscript.js#17a05fThe colour of paid parking.
RATEscript.js2What an hour of parking costs, in euros.
MINUTESscript.js30The minutes chosen at first.
STEPscript.js15By how many minutes minus and plus change it.
MAXscript.js120The longest stay, in minutes: also the dial’s full turn.
HOLDscript.js3.4The seconds the paid state stays before the demo starts again.
LOOPscript.jstrueLeft alone, a pointer adds minutes and pays.

Try them in the Playground

When to use it

In a city’s parking app, a car park’s or a car sharing one; and wherever time is bought in steps: a coworking desk, a sports court, a coin laundry, a charging session.

On phones

The same pill, as wide as the screen: minus, plus and Pay are tapped with a thumb. Under 350 pixels the Pay button narrows a little.

With reduced motion

Arc and price are already in place. Duration, price, colours and labels change without motion; the time left still runs down, digit by digit.

Pitfalls

  • Rate, time of day and durations are made up and the payment is fake: a real app needs the plate, the zone and a payment confirmation, and the time left comes from the server.
  • Minus and plus are real buttons with a label (“15 minutes more”) and go disabled at the limits; duration and end time sit in an aria-live region, so those who cannot see the dial hear the change.
  • Once paid the button has aria-disabled and the state is written (“Paid”), not told by green alone.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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