
The elastic button
Buttons, Hover, Text
The «Park here» button of a made-up parking payment app, in the style of product interface pieces, on white: pressed, the black pill widens into a little street with the blue parking sign; a car seen from the side, with glossy bodywork, windows, headlights and wheels whose rims turn, comes in from the left edge, speeds up and brakes in front of the sign with its nose dipping on the springs and rocking before it stops. The pill says «Parked» and the parking time starts running; on the second tap the car pulls away and leaves over the right edge.
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>
<!--
"Park here 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>The Park here button with the car braking inside it</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" data-stage>
<!-- a black pill: pressed, it widens into a little street; a car drives in from the left, brakes in front of
the parking sign with its nose dipping on the springs, and the pill starts the parking timer.
Pressed again, the car pulls away and leaves over the right edge -->
<div class="park" data-park>
<p class="where" data-where>
<span class="where__brand">Kerbway</span>
<span class="where__dot" aria-hidden="true"></span>
<span>Rua das Flores</span>
<span class="where__dot" aria-hidden="true"></span>
<span data-rate>€1.60 / h</span>
</p>
<button class="pill" type="button" data-pill data-autoclic aria-live="polite">
<span class="pill__ink" aria-hidden="true"></span>
<span class="pill__street" data-street aria-hidden="true">
<span class="road" data-road></span>
<span class="bay" data-bay><i></i><i></i></span>
<span class="sign" data-sign><span class="sign__post"></span><svg class="sign__plate" viewBox="0 0 14 14"><rect x="0.5" y="0.5" width="13" height="13" rx="3"></rect><path d="M5 10.6V3.6h2.6a2.15 2.15 0 0 1 0 4.3H5"></path></svg></span>
</span>
<span class="face face--idle" data-idle>
<svg class="face__p" data-mini viewBox="0 0 14 14" aria-hidden="true"><rect x="0.5" y="0.5" width="13" height="13" rx="3"></rect><path d="M5 10.6V3.6h2.6a2.15 2.15 0 0 1 0 4.3H5"></path></svg>
<span class="face__label">Park here</span>
</span>
<span class="face face--done" data-done aria-hidden="true">
<span class="done__label">Parked</span>
<span class="done__sep" aria-hidden="true"></span>
<span class="timer" data-timer></span>
</span>
<span class="car" data-car aria-hidden="true">
<span class="car__shadow" data-cshadow></span>
<span class="car__beam" data-beam></span>
<svg class="car__svg" viewBox="0 0 64 30">
<defs>
<linearGradient id="carro" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#fbfbfc"></stop>
<stop offset="0.55" stop-color="#e3e4e8"></stop>
<stop offset="1" stop-color="#b9bbc2"></stop>
</linearGradient>
<linearGradient id="vetro" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#3a4150"></stop>
<stop offset="1" stop-color="#151820"></stop>
</linearGradient>
<radialGradient id="cerchio" cx="0.4" cy="0.35" r="0.7">
<stop offset="0" stop-color="#f4f5f7"></stop>
<stop offset="1" stop-color="#9a9da6"></stop>
</radialGradient>
</defs>
<!-- the body: it pitches on its springs, the wheels stay on the road -->
<g class="car__body" data-body>
<path class="body__arches" d="M9.6 22.4a6.4 6.4 0 0 1 12.8 0M42.2 22.4a6.4 6.4 0 0 1 12.8 0"></path>
<path class="body__shell" d="M3.4 21.6c-.7 0-1.2-.5-1.2-1.2v-3.2c0-2.3 1.3-3.8 3.6-4.3l7.8-1.6 5.4-6.1C20.4 3.6 22.4 2.8 25 2.8h11.4c2.4 0 4.3.9 5.8 2.7l4.9 5.8 8.6 1.5c3.4.6 5.6 2.6 5.9 5.6l.2 2.2c.1.7-.5 1.3-1.2 1.3h-5.7a6.4 6.4 0 0 0-12.6-.3H22.4a6.4 6.4 0 0 0-12.6.3Z" fill="url(#carro)"></path>
<path class="body__glass" d="M15.6 11.7 20.2 6.6c1-1.1 2.4-1.6 4-1.6h5.2v6.9Z M31.4 5h4.9c1.7 0 3.1.6 4.1 1.9l3.9 4.8-12.9.3Z" fill="url(#vetro)"></path>
<path class="body__shine" d="M21.4 6.9 18 10.6M33.6 6.3l-2.2 4.9"></path>
<path class="body__pillar" d="M30.4 5v7"></path>
<path class="body__line" d="M14.2 13.4c8 .3 22 .2 32.6-.6M30.4 13v7.4M5.4 17.6h3.4"></path>
<path class="body__handle" d="M23.6 15.2h3.2M35.6 15h3.2"></path>
<path class="body__mirror" d="M45.2 10.8c.5-.9 1.4-1.2 2.2-.9l.3 1.4-2.3.3Z"></path>
<rect class="body__head" data-head x="57.4" y="14.2" width="3.6" height="2.4" rx="1.1"></rect>
<rect class="body__tail" data-tail x="2.2" y="14.6" width="2.6" height="2.6" rx="0.9"></rect>
<path class="body__sill" d="M22.6 21.2h19.2"></path>
</g>
<g class="wheel" data-wheel transform="translate(16.1 22.6)">
<circle r="5.6" class="wheel__tyre"></circle>
<circle r="3.4" fill="url(#cerchio)" class="wheel__rim"></circle>
<g class="wheel__spokes" data-spokes><path d="M0-3.1V3.1M-2.95-.95 2.95.95M-2.95.95 2.95-.95M-1.8-2.5 1.8 2.5M-1.8 2.5 1.8-2.5"></path></g>
<circle r="1.05" class="wheel__hub"></circle>
</g>
<g class="wheel" data-wheel transform="translate(48.6 22.6)">
<circle r="5.6" class="wheel__tyre"></circle>
<circle r="3.4" fill="url(#cerchio)" class="wheel__rim"></circle>
<g class="wheel__spokes" data-spokes><path d="M0-3.1V3.1M-2.95-.95 2.95.95M-2.95.95 2.95-.95M-1.8-2.5 1.8 2.5M-1.8 2.5 1.8-2.5"></path></g>
<circle r="1.05" class="wheel__hub"></circle>
</g>
</svg>
<span class="car__glow car__glow--tail" data-tailglow></span>
<span class="puff" data-puff></span><span class="puff" data-puff></span>
</span>
</button>
<p class="note" data-note>
<svg viewBox="0 0 24 24" aria-hidden="true"><path data-check d="m5.5 12.5 4.2 4.2 8.8-9.4"></path></svg>
<span data-notetext>Tap again to end parking</span>
</p>
</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.
19 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 “Park here button” from Animorio and fit it into my siteThe car is an SVG in three parts: the bodywork in one group, the two wheels in two separate groups. That way the bodywork can pitch on its springs while the wheels stay on the road, as on a real car.
Everything starts from one number, the car’s x. On every update the spokes turn by x divided by the wheel radius, in degrees: the wheels never slip, neither pulling away nor braking, whatever the duration.
The journey is two tweens of the same x: the first with power1.in, which speeds up, the second with power2.out, which brakes. The braking time is worked out so that the two halves meet at the same speed, so there is no jolt at the joint.
While braking a pose object takes the pitch to PITCH degrees around the centre of the body, with half a pixel of sink; at the stop it goes back to zero with elastic.out(1, 0.32), which gives the two rocks of the suspension. Pulling away it is the other way round: the nose lifts.
The parking time is a one-second delayedCall that calls itself again. Every character sits in its own window: the old digit leaves upwards before the new one comes from below, so two digits are never readable in the same window.
| Name | File | Default | What it changes |
|---|---|---|---|
DRIVE | script.js | 1.5 | How many seconds the car takes from the left edge to the spot, braking included. |
LEAVE | script.js | 1.1 | How many seconds it takes to pull away and leave over the right edge. |
PITCH | script.js | 2.6 | How many degrees the nose dips on the springs when braking. |
HOLD | script.js | 4 | How many seconds it stays parked, with the time running, in the automatic loop. |
RATE | script.js | "€1.60 / h" | The rate written above the button. |
SIGN | script.js | #3d7bff | The colour of the parking sign, the only accent. |
INK | script.js | #0b0b0c | The colour of the pill. |
For the button that starts a parking session in a parking payment app, car sharing or car rental: the wait for the confirmation becomes the car arriving and parking, and the button itself keeps the time.
The open pill never goes past the width of the box minus the margins, and the spot and the sign are worked out from its width; a tap does what a click does.
No journey: the label fades, the pill changes width at once and the street, the sign and the car already parked fade in; the time changes without rolling and on the second tap everything fades out the same way.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.5 KB; the libraries: GSAP 28 KB.
Tested on 30 October 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.