
The elastic button
Buttons, Hover, Text
The «Unlock bike» button of a bike-share app, in the style of product interface pieces, on white: the knob holds a real steel padlock; on tap the shackle snaps up and swings open, the lock drops away, the pill fills green from the knob and a spoked bicycle wheel rolls in from the far end, settles and spins once; the ride clock starts. On a second tap the wheel rolls away, the lock comes back and the shackle slams shut.
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>
<!--
"Unlock bike 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 Unlock bike button with the padlock snapping open</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 bike-share app: tap the pill, the steel padlock in the knob snaps open,
drops away, and a spoked wheel rolls in while the pill turns green and the ride starts -->
<div class="dock" data-dock>
<p class="dock__top">
<span class="dock__bike">Bike <span data-bike-num>214</span></span>
<span class="dock__where">Dock 7 · Harbour Street</span>
</p>
<button class="unlock" type="button" data-unlock data-autoclic aria-pressed="false">
<span class="unlock__fill" data-fill aria-hidden="true"></span>
<span class="unlock__knob" data-knob aria-hidden="true">
<svg class="lock" data-lock viewBox="0 0 32 32">
<defs>
<linearGradient id="acciaio" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#7d858f"/>
<stop offset="0.38" stop-color="#eef1f4"/>
<stop offset="0.55" stop-color="#c3cad2"/>
<stop offset="1" stop-color="#6f7781"/>
</linearGradient>
<linearGradient id="corpo" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#3a3f46"/>
<stop offset="0.5" stop-color="#23272c"/>
<stop offset="1" stop-color="#121417"/>
</linearGradient>
<linearGradient id="riflesso" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#fff" stop-opacity="0"/>
<stop offset="0.5" stop-color="#fff" stop-opacity=".55"/>
<stop offset="1" stop-color="#fff" stop-opacity="0"/>
</linearGradient>
<clipPath id="taglio"><rect x="6" y="14" width="20" height="15" rx="4"/></clipPath>
</defs>
<g data-shackle>
<path class="lock__arco" d="M10.6 15.5V10.6a5.4 5.4 0 0 1 10.8 0V15.5"/>
<path class="lock__arco-luce" d="M12 12.4v-1.8a4 4 0 0 1 2.3-3.6"/>
</g>
<g data-body>
<rect class="lock__ombra" x="6.6" y="15.6" width="20" height="15" rx="4"/>
<rect class="lock__corpo" x="6" y="14" width="20" height="15" rx="4"/>
<path class="lock__bordo" d="M9.6 14.7h12.8"/>
<circle class="lock__foro" cx="16" cy="20.4" r="2.1"/>
<path class="lock__foro" d="M15 21.6h2l.5 3.6h-3Z"/>
<path class="lock__vite" d="M8.6 26.6h.01M23.4 26.6h.01"/>
<g clip-path="url(#taglio)"><rect data-glint x="-8" y="12" width="7" height="20" fill="url(#riflesso)" transform="skewX(-18)"/></g>
</g>
</svg>
<svg class="wheel" data-wheel viewBox="-20 -20 40 40">
<g data-spin>
<circle class="wheel__gomma" r="17.2"/>
<circle class="wheel__battistrada" r="17.2"/>
<circle class="wheel__gomma-luce" r="18.9"/>
<circle class="wheel__cerchio" r="14.6"/>
<g class="wheel__raggi" data-spokes></g>
<circle class="wheel__mozzo" r="2.6"/>
<circle class="wheel__perno" r="0.9"/>
<rect class="wheel__valvola" x="-0.7" y="-16.4" width="1.4" height="2.6" rx=".5"/>
</g>
</svg>
</span>
<span class="unlock__words">
<span class="unlock__label" data-idle>Unlock bike</span>
<span class="unlock__label unlock__label--on" data-on aria-hidden="true"><span>Unlocked · Bike <span data-bike-num>214</span></span></span>
<span class="unlock__label unlock__label--end" data-end aria-hidden="true">Tap to end ride</span>
</span>
</button>
<p class="dock__note">
<span class="dock__state" data-note-idle>€0.25 per minute · first 5 free</span>
<span class="dock__state dock__state--ride" data-note-ride aria-hidden="true">Ride <span class="dock__time" data-time>0:00</span> · battery 92%</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.
22 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 “Unlock bike button” from Animorio and fit it into my siteThe padlock is an SVG with three gradients: a horizontal one for the shackle’s steel (dark at the sides and light in the middle, like a tube catching the light), a vertical one for the body and a transparent one for the glint, which slides inside a clipPath the size of the body. The shackle is its own group with svgOrigin on its right leg: it rises with back.out and then turns minus 34 degrees, the way it really opens.
The click is three things together on one timeline: the shackle rising almost five units, the body shaking one pixel right and left in a tenth and a half of a second, and the knob squeezing to 0.92 and coming back with elastic.out. Take one away and it looks like an icon moving; together it looks like a mechanism.
The wheel starts from the far end of the pill, measured every time, and arrives at the knob. As it moves, the spoke group turns by distance over radius, in radians: so it never slides or skids. The sixteen spokes are created in the script, each one leaving the hub slightly offset from where it meets the rim, alternating direction, and they cross like real ones.
The green is a circle behind the knob, size zero, that grows to twice the pill’s diagonal while staying centred on the knob; the pill has overflow hidden, so you see a wave leaving the lock and filling it.
On the second tap the wheel travels back turning the right way, the green shrinks back, the lock drops in with its shackle already open, the shackle straightens and comes down hard with power4.in, and only then does the body squash: the sound of the hit arrives when the shackle meets the body.
| Name | File | Default | What it changes |
|---|---|---|---|
SNAP | script.js | 0.5 | How long the padlock’s snap open lasts, in seconds. |
ROLL | script.js | 0.95 | How long the wheel takes to roll in to the knob, in seconds. |
HOLD | script.js | 2.4 | How many seconds «Unlocked» stays before turning into «Tap to end ride». |
BIKE | script.js | 214 | The bike’s number. |
INK | script.js | #0b0c0e | The colour of the locked pill. |
ACCENT | script.js | #17b26a | The green of the pill when the bike is unlocked. |
For the button that unlocks a vehicle in a bike, scooter or car sharing app, or for any action that opens something physical (a locker, a door, a storage unit): the padlock snapping open tells you at once what happened.
On the phone the pill adapts to the width (at most 300 pixels, with a 16-pixel margin) and the wheel’s path is measured every time; there is no hover, everything else is the same.
The padlock and the wheel swap with a fade, without snaps or rolling, the green spreads without a spring, the labels change with a fade and the drawn pointer is not shown.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.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.