
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteEvery 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.
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.
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.
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 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.
| Name | File | Default | What it changes |
|---|---|---|---|
FARE | script.js | 412 | The live fare at rest, in dollars. |
LOCKED_FARE | script.js | 409 | The fare the digits stop on when it is locked. |
FROM_CODE | script.js | LIS | The airport you leave from. |
TO_CODE | script.js | JFK | The airport you fly to. |
HOURS | script.js | 48 | How many hours the fare stays held. |
TICK | script.js | 1.5 | How many seconds between two live updates of the fare. |
SPIN | script.js | 1.4 | How many seconds the digits spin before they stop. |
SPRING | script.js | 1 | How springy the press and the click are: 0.4 calm, 2 very bouncy. |
HOLD | script.js | 2.6 | How many seconds Fare locked stays before it unlocks. |
AUTO | script.js | true | The button goes round by itself until someone touches 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 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.
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.
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.
Tested on 2 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.