
The layered button
Buttons, Hover, Physics
The price filter of Northvale, a made-up online shop of trail running shoes, in a white card from a premium shot. Over the chosen range sits a glass lens that runs from the price histogram down to the track, with the two handles at its corners: you can drag the handles one at a time, or grab the lens in the middle and slide the whole range at once, with a sheen that leans the way it goes. The bars inside light up orange with an elastic hop, the ones outside sink, Min, Max and the result count roll digit by digit, and the Show products button takes the number with a small swell and a light.
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>
<!--
"Glass lens price slider" 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 price range slider with the glass lens that slides the range</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>
<!-- the price filter of Northvale, an invented shop of trail running shoes: a histogram of the prices, a glass
lens over the chosen range that can be grabbed and slid as a whole, two handles at its corners, rolling
prices and the number of results that the Show button takes -->
<section class="filter" aria-labelledby="f-title" data-card>
<header class="filter__head">
<div>
<h2 class="filter__title" id="f-title">Price</h2>
<p class="filter__sub">Northvale · Trail running shoes</p>
</div>
<button class="reset" type="button" data-reset>
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.6 6.4A4.8 4.8 0 1 1 3.4 9.6"/><path d="M3.2 3.4v3.2h3.2"/></svg>
<span>Reset</span>
</button>
</header>
<div class="range" data-range>
<div class="bars" aria-hidden="true" data-bars></div>
<div class="track" aria-hidden="true"><span class="track__fill" data-fill></span></div>
<div class="lens" role="slider" tabindex="0" aria-label="Move the price range" data-lens>
<span class="lens__glass" data-glass>
<span class="lens__tint"></span>
<span class="lens__sheen" data-sheen></span>
<span class="lens__grip" aria-hidden="true"><i></i><i></i><i></i></span>
</span>
</div>
<span class="thumb" role="slider" tabindex="0" aria-label="Minimum price" data-thumb>
<span class="thumb__body" data-body><span class="thumb__core"></span></span>
</span>
<span class="thumb" role="slider" tabindex="0" aria-label="Maximum price" data-thumb>
<span class="thumb__body" data-body><span class="thumb__core"></span></span>
</span>
</div>
<div class="fields">
<div class="field" data-field>
<span class="field__key">Min</span>
<span class="field__val">$<span class="roll" data-roll-lo></span></span>
</div>
<span class="fields__line" aria-hidden="true"></span>
<div class="field" data-field>
<span class="field__key">Max</span>
<span class="field__val">$<span class="roll" data-roll-hi></span><span class="field__plus" data-plus>+</span></span>
</div>
</div>
<button class="show" type="button" data-show>
<span class="show__face" data-show-face>
<span class="show__sweep" data-sweep aria-hidden="true"></span>
<span class="show__words">Show <span class="roll" data-roll-count></span> <span data-noun>products</span></span>
<svg class="show__chev" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.8 10.2 8 6 12.2"/></svg>
</span>
</button>
<p class="sr" aria-live="polite" data-live></p>
</section>
<svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer>
<path d="M5 3.2l13.6 8.3-6 1.2-3.1 5.6z"/>
</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.
34 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 “Glass lens price slider” from Animorio and fit it into my siteEach handle has the finger’s value and the drawn one: on every frame of GSAP’s ticker a damped spring (stiffness and friction among the values) pulls the second towards the first, with the time step capped at 1/30 of a second. The numbers follow the finger; the handles, the lens and the bars follow the spring.
The lens is a div laid between the two handles: its left and width come from the drawn values. Grabbed in the middle, it remembers the two starting values and moves both by the same distance, keeping the width and stopping at the ends of the scale. The sheen is a slanted band that shifts and tilts with the average speed of the two handles and drifts back to the centre by itself.
Each bar knows the price at its centre: when it passes in or out of the drawn values it changes class (colour in a CSS transition) and GSAP takes it to full height with an elastic.out or lowers it with a power3.out. The product count adds up the bars in proportion to how much of each one sits inside the range.
Each digit is a column from 0 to 9 in a box 1ch wide with tabular figures: GSAP moves the column’s yPercent. Extra boxes shrink to zero width, so 95 and 115 stay centred with no leading zeros.
| Name | File | Default | What it changes |
|---|---|---|---|
LOWEST | script.js | 40 | The lowest price on the scale, in dollars. |
HIGHEST | script.js | 320 | The highest price on the scale, shown with a plus. |
START_MIN | script.js | 90 | Where the minimum sits when it opens. |
START_MAX | script.js | 190 | Where the maximum sits when it opens. |
STEP | script.js | 5 | How many dollars a handle moves by and the multiple it settles on. |
GAP | script.js | 25 | The smallest distance between the two handles. |
BARS | script.js | 40 | How many bars the histogram has. |
TOTAL | script.js | 438 | How many shoes the shop has in all. |
STIFFNESS | script.js | 420 | The spring pulling the handles and the lens to the finger. |
DAMPING | script.js | 24 | Lower lets them pass the mark and come back. |
SWELL | script.js | 1.22 | How much a grabbed handle swells. |
SINK | script.js | 0.36 | How tall the bars outside the range stay. |
SPEED | script.js | 1 | The speed of the round on its own. |
AUTO | script.js | true | The drawn pointer that plays with the filter until someone touches it. |
--accent | style.css | #ff5a1f | The orange of the lit bars, the track and the fields. |
--button | style.css | #141414 | The colour of the Show products button. |
In the filter column of an online shop (shoes, clothes, electronics, homes for sale), when the buyer wants to keep the same budget and move it up or down: with the lens it takes one gesture instead of moving two handles.
The card narrows to 90% of the screen and the chart gets shorter with the height of the box; the finger grabs the handles and the lens like the mouse, and a tap on the track brings the nearest handle there. Nothing scrolls sideways while dragging.
No springs, hops or self-moving pointer: the card fades in with the range already in place, the handles follow the finger without bouncing, the bars change colour with a fade and the digits change without rolling.
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 16 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.