Skip to content
animorio
IT
All components

Unlock bike button

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

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.

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>
<!--
  "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>

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.

22 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 “Unlock bike 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 there is the line «Bike 214» with «Dock 7 · Harbour Street», below it a black pill with a white knob on the left and the words «Unlock bike», and below that «€0.25 per minute · first 5 free». The knob holds a padlock drawn like a real one: the shiny steel shackle with its highlight, the dark body with a light rim, the keyhole and two screws. Hovering lifts the shackle a hair and a glint runs over the steel. On tap the pill gives, the knob squeezes and comes back on a spring, the shackle snaps up with a bounce while the body shakes from the click, then the shackle swings sideways and opens; the lock drops away, tilting. Meanwhile green spreads from the knob until it fills the pill, «Unlock bike» rises away and «Unlocked · Bike 214» arrives. From the far end of the pill a bicycle wheel rolls in (tyre with tread, rim, sixteen crossed spokes, hub and valve), turning exactly as much as the distance it travels, settles with a small bounce and spins once more. Below, «Ride 0:00» starts counting the seconds. After a moment the label becomes «Tap to end ride». On a second tap the wheel rolls off to the far end, the green shrinks back into the knob, the lock drops back in place with its shackle open, the shackle straightens and slams shut, the body squashes and recovers, and «Unlock bike» returns. A drawn pointer runs the loop by itself; at the first real touch it steps aside.

How it works

The steel padlock

The 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

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 that rolls true

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 from the knob

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.

The way back

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.

Values to change

NameFileDefaultWhat it changes
SNAPscript.js0.5How long the padlock’s snap open lasts, in seconds.
ROLLscript.js0.95How long the wheel takes to roll in to the knob, in seconds.
HOLDscript.js2.4How many seconds «Unlocked» stays before turning into «Tap to end ride».
BIKEscript.js214The bike’s number.
INKscript.js#0b0c0eThe colour of the locked pill.
ACCENTscript.js#17b26aThe green of the pill when the bike is unlocked.

Try them in the Playground

When to use it

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 phones

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.

With reduced motion

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.

Pitfalls

  • The wheel’s rotation is on a group inside, its movement on the whole SVG: with both on the same element GSAP would turn the wheel around the wrong point.
  • The knob has no overflow hidden, otherwise the wheel would only appear inside the white circle: the clipping is done by the pill, which has overflow hidden and its own isolation to keep the green behind the knob.
  • The wheel’s path is measured on the spot from the pill’s width: in fixed pixels, in the narrow phone box the wheel would start outside or halfway.

Libraries

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.

Testing

Tested on 30 October 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