
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteThe 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 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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2f6bff | The meter’s colour while choosing. |
PAID | script.js | #17a05f | The colour of paid parking. |
RATE | script.js | 2 | What an hour of parking costs, in euros. |
MINUTES | script.js | 30 | The minutes chosen at first. |
STEP | script.js | 15 | By how many minutes minus and plus change it. |
MAX | script.js | 120 | The longest stay, in minutes: also the dial’s full turn. |
HOLD | script.js | 3.4 | The seconds the paid state stays before the demo starts again. |
LOOP | script.js | true | Left alone, a pointer adds minutes and pays. |
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.
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.
Arc and price are already in place. Duration, price, colours and labels change without motion; the time left still runs down, digit by digit.
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.
Tested on 19 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.