Skip to content
animorio
IT
Back to the library

Glass shelf filters

Physics, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.1 KBGSAP 28 KBFreeDownload the zip

The filters of a made-up shirt shop, Halcourt, on white, in the style of real product interface pieces: a chosen filter jumps out of its row and lands with real physics on a small glass shelf, bounces, bumps the others and stacks on two rows; tapped on the shelf it goes back home, and Clear tilts the shelf and slides them all off.

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>
<!--
  "Glass shelf filters" 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 filters that fly onto a glass shelf</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 filters of a made-up shirt shop, Halcourt: a chosen filter jumps out of its row and lands on a small
         glass shelf with real physics, bumping and stacking on the others; tap one on the shelf and it jumps back
         home; Clear tilts the shelf and they all slide off -->
    <section class="card" data-card aria-label="Shirt filters">
      <header class="head">
        <div class="brand">
          <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.2 3.5 4 6.2l1.7 3.6 1.9-.9V20h8.8V8.9l1.9.9L20 6.2l-4.2-2.7c-.6 1.6-2 2.5-3.8 2.5S8.8 5.1 8.2 3.5Z"/></svg>
          <div class="brand__txt">
            <span class="brand__name" data-brand>Halcourt</span>
            <span class="brand__cat">Shirts</span>
          </div>
        </div>
        <button class="clear" type="button" data-clear disabled>Clear</button>
      </header>

      <div class="label">
        <span>Active filters</span>
        <span class="label__n" data-active>None yet</span>
      </div>
      <div class="shelf" data-shelf>
        <span class="shelf__floor" aria-hidden="true"></span>
        <span class="shelf__sheen" aria-hidden="true"></span>
        <span class="shelf__hint" data-hint>Pick a filter below</span>
      </div>

      <div class="label label--panel"><span>Filter by</span></div>
      <div class="slots" data-slots></div>

      <button class="show" type="button" data-show>
        <span>Show</span>
        <span class="show__n" data-count>1,248</span>
        <span>shirts</span>
        <svg class="show__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.8 4.2 12.6 8l-3.8 3.8"/></svg>
      </button>

      <div class="chips" data-chips></div>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></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.

25 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 “Glass shelf filters” 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 warm white background there is the white filter card of Halcourt, a made-up shirt shop: at the top the brand with its drawn shirt, the category Shirts and the Clear button, off until it is needed. Below there is a small glass shelf, pale, with its floor line and the words Pick a filter below; further down the row of filters, six white pills with their plus (Linen, Under €80, In stock, Oversized, Navy, Size M) and at the bottom the black button Show 1,248 shirts. Tap a filter and the pill squashes for a moment and jumps out of its row along an arc, turning a little; a dashed outline stays in its place. It rises above the shelf, drops into it, bounces, straightens with a spring and slides to the left up to the other filters; every landing sends a reflection across the glass and lowers the shelf by a pixel. When the first row is full the new filter lands on top of the others, and if it rests on too little it slides off the edge. On the shelf the pill turns indigo and its plus turns into a cross; the number on the button rolls to the results left and above the shelf you read how many filters are active. Tap a filter on the shelf and it jumps away and back into its outline with a small squash, and the others close up. Clear tilts the shelf: the filters slide to the right, fall off the edge one after another and each flies back to its place, then the shelf straightens with a bounce. A drawn pointer picks four filters, removes one and clears everything, then starts again; you can also do it for real.

How it works

Every filter’s place

The row holds six empty placeholders, as wide as the pills measured after document.fonts.ready; the real pills all live in a layer above the card and take their home from the placeholders’ offsets, so the maths holds up even when the page is scaled down. When a pill leaves, its placeholder shows a dashed outline.

The flight

The flight is a real throw: given the starting point, the landing point above the shelf and the time FLIGHT, the starting speed comes from gravity (vy = (dy − g·T²/2) / T). The pill rises, passes over the glass and drops into the shelf, where the physics takes over.

The physics on the shelf

Every pill is a rectangle with a position, a speed and a spring rotation just for the eye. On every frame, in four substeps, gravity and a pull to the left move it; the floor stops it with the BOUNCE rebound, and collisions between pills are solved on the axis where they overlap least, with the impulse they trade. A pill resting on less than a third of the one below slides off.

The shelf that tilts

Clear takes the shelf’s angle to TILT degrees: gravity splits into a part along the glass and a part against it, the pull to the left switches off and the right edge opens. The pills are computed in the shelf’s own frame and drawn rotated around its centre; the one that passes the edge sets off on a flight home.

The drawn pointer

The autopilot is an async function with gsap.delayedCall that reads every position on the spot: it picks four filters, removes one from the shelf, presses Clear and waits for the shelf to be empty. The first real touch stops it; after eight quiet seconds it clears the shelf and starts again.

Values to change

NameFileDefaultWhat it changes
BRANDscript.js'Halcourt'The name of the made-up shop, written above the category.
GRAVITYscript.js2400Gravity in pixels per second per second: higher means lower flights and sharper falls.
BOUNCEscript.js0.3How much a filter bounces when it hits the shelf or another filter.
FLIGHTscript.js0.5The seconds of a filter’s flight from its row to the shelf.
PULLscript.js700The pull that gathers the filters to the left, side by side.
TILTscript.js7The degrees the shelf tilts when Clear is pressed.
HOLDscript.js1.6The seconds the drawn pointer pauses between one gesture and the next.

Try them in the Playground

When to use it

For the filters of an online shop, a catalogue or an archive: whoever chooses sees where each filter goes, finds them all together in one place and removes them with a tap, one at a time or all at once.

On phones

The same animation with adapted sizes: the card narrows on the width and the height, the pills wrap in the row and fewer fit on each shelf row, so the second row arrives sooner.

With reduced motion

No flights or bounces: the shelf starts with three filters already in place, and a filter picked or removed fades out and back in where it belongs; Clear brings them all back to the row the same way.

Pitfalls

  • Positions are read with offsetLeft and offsetTop climbing up to the card, not with getBoundingClientRect: in the phone box the page may be scaled down, and screen measurements would not match the coordinates of the pill layer.
  • The flying pill takes no part in collisions until it has dropped back into the shelf: otherwise, on the way up, it crossed the glass from below and pushed the others upwards.
  • With the pull to the left always on, the pills never reached the right edge while clearing: during Clear the pull switches off, the glass’s friction drops and gravity along the tilted shelf remains; meanwhile the Active filters row fades, because the left side of the shelf rises in front of it.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 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 animations