Skip to content
animorio
IT
All components

Lock fare button

Buttons, Hover, TextGSAP, CSS onlyMediumCompressed weight: Demo 10 KBGSAP 28 KBFreeDownload the zip

The Lock this fare button of a flight booking app, in dark graphite on a near black page with a warm light, like a Dribbble shot: at rest the fare is live and its digits roll up and down by a few dollars like an odometer, with a small triangle saying which way it went. Pressed, the button gives and springs back, the digits spin and stop one after the other, passing their mark by a hair, a ring of golden light draws itself around the price, the lock shuts with a click and the button says Fare locked, with the 48 hours counting 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>
<!--
  "Lock fare 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 Lock fare button with the digits that stop</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">
    <!-- the Lock this fare button of a flight booking app. At rest the fare is live: its digits roll up and down by a
         few dollars and a thin light runs over the price at every update. Pressed, the button gives and springs back,
         the digits spin and slow down one after the other like a counter settling, a light ring draws itself around
         the price, the shackle of the lock comes down with a click and the button says Fare locked, held for 48 hours,
         with the countdown running. Then it unlocks and the fare is live again -->
    <div class="fl" data-wrap>
      <span class="fl__spill" data-spill aria-hidden="true"></span>
      <button class="fl__btn" type="button" data-btn aria-label="Lock this fare, Lisbon to New York, 412 dollars">
        <span class="fl__body" data-body>
          <span class="fl__shell" aria-hidden="true"></span>
          <span class="fl__shine" data-shine aria-hidden="true"></span>
          <span class="fl__sweep" aria-hidden="true"><span class="fl__sweep-band" data-sweep></span></span>
          <span class="fl__row">
            <span class="fl__icon" data-icon aria-hidden="true">
              <span class="fl__icon-glow" data-icon-glow></span>
              <svg viewBox="0 0 24 24">
                <g data-shackle>
                  <path class="fl__shackle" d="M8.2 11V8.4a3.8 3.8 0 0 1 7.6 0V11"/>
                </g>
                <rect class="fl__lockbody" data-lockbody x="5.4" y="10.6" width="13.2" height="9.8" rx="2.8"/>
                <path class="fl__keyhole" data-keyhole d="M12 14.3v2.2"/>
              </svg>
            </span>
            <span class="fl__text" aria-hidden="true">
              <span class="fl__labels">
                <span class="fl__label" data-label>Lock this fare</span>
                <span class="fl__label fl__label--busy" data-label>Locking fare</span>
                <span class="fl__label" data-label>Fare locked</span>
              </span>
              <span class="fl__subs">
                <span class="fl__sub" data-sub><span data-from>LIS</span><svg class="fl__arrow" viewBox="0 0 14 8"><path d="M1 4h11M9 1.2 12 4 9 6.8"/></svg><span data-to>JFK</span><span class="fl__sep">·</span><span class="fl__live">live</span></span>
                <span class="fl__sub" data-sub>Holding today’s price</span>
                <span class="fl__sub" data-sub>Held <span class="fl__clock" data-clock>47:59:59</span></span>
              </span>
            </span>
            <span class="fl__price" data-price aria-hidden="true">
              <span class="fl__scan" aria-hidden="true"><span class="fl__scan-band" data-scan></span></span>
              <svg class="fl__ring" data-ring aria-hidden="true">
                <defs>
                  <linearGradient id="fl-grad" data-grad gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="90" y2="0">
                    <stop offset="0" stop-color="var(--gold)"/>
                    <stop offset="0.5" stop-color="#fff4dc"/>
                    <stop offset="1" stop-color="var(--gold)"/>
                  </linearGradient>
                </defs>
                <path class="fl__ring-glow" data-ring-glow/>
                <path class="fl__ring-line" data-ring-line/>
              </svg>
              <span class="fl__trend" data-trend>
                <svg viewBox="0 0 10 10"><path class="fl__trend-up" data-trend-up d="M5 2.2 8.4 7.4H1.6z"/><path class="fl__trend-down" data-trend-down d="M5 7.8 8.4 2.6H1.6z"/></svg>
              </span>
              <span class="fl__amount">
                <span class="fl__cur">$</span>
                <span class="fl__digits" data-digits></span>
              </span>
            </span>
          </span>
        </span>
      </button>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

29 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 “Lock fare 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 a near black page, with a warm light falling from above and a very fine grain, alone in the middle there is a pill button 60 pixels tall, in dark graphite: the top edge catches the light in one pixel, the bottom one stays in shadow, and under the button the floor warms with a golden glow. On the left, in a round well, an open padlock; in the middle «Lock this fare» and under it, small, «LIS» arrow «JFK · live»; on the right, in a sunken capsule, the price «$412». The fare is live: every second and a half the digits go up or down by a few dollars, rolling like an odometer, each passing its mark by a hair and settling, a small orange or green triangle turns to say which way it went, the new figure lights up white for an instant and a thread of light runs along the top edge of the capsule. With the mouse over it, a warm light follows the pointer inside the pill, the shackle of the padlock lifts a little more and sways, and the capsule's edge lights up faintly. Pressed, the button sinks by a pixel and narrows, then springs back. The words become «Locking fare» with a band of light passing through them and under them «Holding today's price»; the triangle disappears, the digits spin all together, blurred by a hair, and stop one after the other from the left on $409, while a ring of golden light draws itself around the capsule starting from the top centre. When the last digit stops, the shackle comes down with a click and a bounce, the body of the padlock squashes slightly, the well turns gold, the ring flashes, the pill swells by a hair and a reflection crosses it from left to right. The words say «Fare locked» and under them «Held 47:59:59», with the seconds counting down. After a moment the button unlocks: the shackle rises on a spring, the ring withdraws, the triangle comes back and the fare starts moving again. Until someone touches it, it goes round by itself; pressed while locked, it unlocks at once.

How it works

An odometer of columns

Every digit is a window one line tall holding a column of thirty numbers, 0 to 9 written three times. A digit's state is a decimal number v: GSAP moves it and the column goes to a yPercent of minus (10 + v modulo 10) thirtieths. Going from 9 to 10 the column jumps to an identical copy, so the turn never ends and the jump never shows.

The live fare

A delayedCall every TICK seconds takes the next step of a fixed walk (+3, −5, +2…), so every loop is the same and the fare never drifts more than 9 dollars away. Each digit takes the road in the right direction (adding or removing 10) and travels it with back.out: it passes the number by a hair and comes back. The triangle turns by 180 degrees with svgOrigin and changes colour, and a one pixel thread of light crosses the capsule.

The digits that stop

On a press every digit gets extra whole turns (one, two, three going right) and a duration 0.3 seconds longer than its neighbour: they spin together and stop from the left, like the drums of a counter. A 0.7 pixel blur filter fading out with power3.in makes the motion blur.

The ring on the capsule's edge

A pill shaped SVG path starting at the top centre, rebuilt by a ResizeObserver to the capsule's size; two copies, a thin one and a thicker blurred one. The state is made of shares of the edge (from where to where), so strokeDasharray and strokeDashoffset draw it while the digits spin and withdraw it the same way on unlock.

The click of the lock

The shackle is an SVG group of its own: open, it sits 2.7 units higher, on hover it rises again and sways with rotation keyframes around its right leg. On closing it drops in 0.13 seconds 0.6 past the mark and comes back with elastic.out, while the body squashes with scaleY around its base and the well lights up. The countdown reads gsap.ticker.time and changes the text only when the second changes.

Values to change

NameFileDefaultWhat it changes
FAREscript.js412The live fare at rest, in dollars.
LOCKED_FAREscript.js409The fare the digits stop on when it is locked.
FROM_CODEscript.jsLISThe airport you leave from.
TO_CODEscript.jsJFKThe airport you fly to.
HOURSscript.js48How many hours the fare stays held.
TICKscript.js1.5How many seconds between two live updates of the fare.
SPINscript.js1.4How many seconds the digits spin before they stop.
SPRINGscript.js1How springy the press and the click are: 0.4 calm, 2 very bouncy.
HOLDscript.js2.6How many seconds Fare locked stays before it unlocks.
AUTOscript.jstrueThe button goes round by itself until someone touches it.

Try them in the Playground

When to use it

For an app or site selling flights, trains, hotel rooms or event tickets with changing prices: the button that holds the fare for a few hours before paying. The moving digits say the price is live, and the moment they stop is the button's promise.

On phones

On the phone the pill is at most 86% of the screen wide and the ring redraws to the capsule's size; there is no hover, so the warm light turns on under the finger at the touch and the rest, digits and padlock included, is the same.

With reduced motion

Nothing moves: the digits change in place with a fade instead of rolling, the padlock closes without a click while the well fades to gold, the ring fades in whole, the words swap in place and there is no reflection.

Pitfalls

  • With Mona Sans tabular figures the one has a foot and the price looks typewritten: every digit already sits in a fixed width window, so plain centred figures are enough.
  • An odometer with a single column from 0 to 9 jumps backwards going from 9 to 0: with three copies and the position taken modulo 10 from the middle, the turn goes on forever.
  • On hover the ring is already whole and faint: on click it has to start again from zero, or the drawing of the bright ring does not show.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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