
The elastic button
Buttons, Hover, Text
The amenities filter in a stay search: six amenities to switch on (pool, pet friendly, parking, breakfast, spa, sea view). Each amenity switched on takes colour, its icon lights up and a tick draws; meanwhile the stays left count to the new number, the bar shortens on a spring, the sentence says what is being asked for and the button updates its number.
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>
<!--
"Amenities filter" 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>Amenities filter</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 amenities filter of a hotel search: every amenity switched on narrows the stays, the count rolls,
the bar shortens and the sentence says what is being asked for -->
<section class="am" data-am aria-labelledby="am-title">
<header class="am__head">
<span class="am__name"><b id="am-title">Stays in Lisbon</b><span>12 – 15 June, 2 guests</span></span>
<span class="am__count" aria-live="polite"><b data-count>128</b><span>stays</span></span>
</header>
<div class="am__meter" aria-hidden="true"><i data-meter></i></div>
<div class="am__grid" role="group" aria-label="Amenities">
<button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.42"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.500 15c1.400 0 1.400 1 2.800 1s1.400-1 2.800-1 1.400 1 2.800 1 1.400-1 2.800-1 1.400 1 2.800 1M3.500 19c1.400 0 1.400 1 2.800 1s1.400-1 2.800-1 1.400 1 2.800 1 1.400-1 2.800-1 1.400 1 2.800 1M8 12.500V6a2 2 0 0 1 4 0M14 12.500V6a2 2 0 0 1 4 0M8 9.500h6"></path></svg><span>Pool</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
<button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.31"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 12.500c-2.400 0-4.500 2.300-4.500 4.300 0 1.300 1 2.200 2.300 2.200.900 0 1.400-.400 2.200-.400s1.300.400 2.200.400c1.300 0 2.300-.900 2.300-2.200 0-2-2.100-4.300-4.500-4.300ZM7 10.500a1.400 1.800 0 1 0 0-.100ZM10.500 6.500a1.400 1.800 0 1 0 0-.100ZM16.300 6.500a1.400 1.800 0 1 0 0-.100ZM19.800 10.500a1.400 1.800 0 1 0 0-.100Z"></path></svg><span>Pet friendly</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
<button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.58"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="4.500" y="4.500" width="15" height="15" rx="4"></rect><path d="M10 16V8h2.600a2.400 2.400 0 0 1 0 4.800H10"></path></svg><span>Parking</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
<button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.66"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 10h11v3.500a5.500 5.500 0 0 1-11 0ZM16 11h1.500a2 2 0 0 1 0 4H16M8 4.500c0 1 1 1 1 2M12 4.500c0 1 1 1 1 2M4.500 20.500h12"></path></svg><span>Breakfast</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
<button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.24"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20c-4.400 0-7.500-2.500-8-6 2.300-.200 4.200.500 5.600 1.900M12 20c4.400 0 7.500-2.500 8-6-2.300-.200-4.200.500-5.600 1.900M12 20c-2.200-1.800-3.300-4-3.300-6.800 0-2.900 1.200-5.500 3.300-7.700 2.100 2.200 3.300 4.800 3.300 7.700 0 2.800-1.100 5-3.300 6.800Z"></path></svg><span>Spa</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
<button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.37"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.500 18c1.400 0 1.400 1 2.800 1s1.400-1 2.800-1 1.400 1 2.800 1 1.400-1 2.800-1 1.400 1 2.800 1M6.500 14.500a5.500 5.500 0 0 1 11 0M12 5v1.500M5.200 7.800l1.100 1.100M18.800 7.800l-1.100 1.100"></path></svg><span>Sea view</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
</div>
<p class="am__say"><span data-say>Any amenities</span></p>
<div class="am__foot">
<button class="am__clear" type="button" data-clear disabled>Clear</button>
<button class="am__go" type="button" data-go><span class="am__gotext"><span data-golabel>Show 128 stays</span></span></button>
</div>
</section>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.
25 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Amenities filter” from Animorio and fit it into my siteThe stays left are the total times what each chosen amenity lets through. From that number a function works out the count, the bar, the sentence and the button’s words.
Each amenity is a button with aria-pressed: CSS colours edge, ground and icon and draws the tick (a path with pathLength 1); GSAP only gives the bounce.
A number in an object taken to the new value in COUNT seconds and written rounded on every frame, with tabular figures.
scaleX equal to the stays left divided by the total, on a spring that goes slightly past the size.
The names of the chosen amenities lined up with commas and “and” before the last: it says in words what the colours show.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #4fd1c5 | The colour of the chosen amenities, of the bar and of the button. |
STAYS | script.js | 128 | How many stays there are before filtering. |
COUNT | script.js | 0.55 | How long the changing count of stays lasts. |
SPRING | script.js | 1 | How much the amenities and the number bounce: 0.3 = a little, 2 = a lot. |
LOOP | script.js | true | Left alone, the demo’s pointer switches on three amenities, removes one and clears. |
In the search of a site for hotels, holiday homes, campsites or farm stays, and wherever a list is filtered by features: flats to rent, restaurants, gyms, event spaces.
The same card, as wide as the screen minus the margins: the amenities stay in two columns, 42 pixels tall, with long names cut by an ellipsis; the sentence below never wraps.
No bounces and no counting numbers: the amenity changes colour and the tick appears, the count, the bar, the sentence and the button go straight to the new value. The demo does not move by itself.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.5 KB; the libraries: GSAP 28 KB.
Tested on 24 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.
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.