Skip to content
animorio
IT
Back to the library

Pushing search filters

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

The filters of Nestwell, a made-up home search, on white, in the style of real product interface pieces: a filter picked from the list flies up in an arc and lands in the bar, where the chips are real bodies on a barely tilted tray: they slide, bump into each other in a chain, tilt and settle. Removing one closes the row, and when there is room the first chip of the second row hops up; the number of homes rolls with every choice.

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>
<!--
  "Pushing search 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 home search filters that land and push each other in the bar</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 home search, Nestwell: a filter picked below flies up in an arc and lands in the bar,
         where the chips are bodies on a barely tilted tray: they slide, bump into each other in a chain, tilt and
         settle; removing one closes the gap, and when there is room the first chip of the second row hops up -->
    <section class="card" data-card aria-label="Home search filters">
      <header class="head">
        <div class="head__txt">
          <span class="head__kicker">Nestwell · Buy</span>
          <h1 class="head__title">Homes in <span data-city>Lisbon</span></h1>
        </div>
        <button class="clear" type="button" data-clear>Clear all</button>
      </header>

      <div class="tray" data-tray aria-label="Active filters">
        <span class="tray__ph" data-ph>Pick a filter below</span>
      </div>

      <p class="label">Popular filters</p>
      <div class="opts" data-opts></div>

      <button class="show" type="button" data-show aria-label="Show 128 homes">
        <span class="show__in" data-show-in>Show <span class="count" data-count aria-hidden="true"></span> homes</span>
      </button>

      <div class="layer" data-layer></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.

28 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 “Pushing search 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 white background sits the white card of the Nestwell search, a made-up homes app: at the top Nestwell · Buy and the title Homes in Lisbon; below, the filter bar, a very light grey tray with two rows and the words Pick a filter below; then Popular filters, seven pill filters with their drawn icon (Garden, 2 beds, Pets, Balcony, Parking, Pool, Lift); at the bottom the black button Show 128 homes. The drawn pointer picks Garden: the filter stays behind as a dashed outline and its chip, with the icon and the x to remove it, flies up in an arc, leans in the direction of flight and lands in the bar, squashing a little; from there it slides left to the edge, bounces lightly and settles. The number in the button rolls to 67. Then Pets, 2 beds, Balcony and Lift: each chip lands a little to the right of its place and slides into the ones already there, which push one another in a chain, tilt by a degree and straighten up; once the first row is full the chips land in the second. The pointer removes Pets with its x: the chip lifts slightly and vanishes, the ones on its right slide over to close the gap and bump into each other, and as soon as there is room the first chip of the second row hops up in a small arc and joins the line. The Show button is pressed and squashes on a spring; then Clear all, which appeared with the first filter, removes the chips one after another from the right, the filters return solid with a little tap and the number rolls back to 128. With a real mouse every filter can be picked and removed, from the list or from its x; if the bar has no room left the filter gives a small shake.

How it works

The flight

The chip is born on top of the chosen filter and flies to its place in the line, twenty-six pixels further right, in FLIGHT seconds under the gravity GRAVITY: the launch speed is worked out from the distance and the time, so the arc lands exactly on the bar. In flight the chip leans the way it is going, on a spring.

The landing

When it reaches the bar, the downward speed becomes a squash that springs back, and the sideways one becomes a push to the left, KICK, plus a third of what it had: the chip slides into the others.

The tilted tray

In the bar each chip is pushed left by SLOPE and slowed by FRICTION. Collisions are solved four times per step, row by row: overlapping chips separate and swap speed like two equal bodies, with BOUNCE of restitution; the hit tilts them slightly, and a spring straightens them again.

The second row

A chip that does not fit in the first row lands in the second. When room opens up in the first and the first chip of the second is still, it hops up in a shorter arc, forty-two hundredths of a second, and joins the line.

The number

Each filter narrows the search by its own share; the rounded total rolls in the button with one column of digits per position, as wide as its digit, with back.out and five hundredths between columns. The physics runs in GSAP’s ticker in fixed steps of a hundred-and-twentieth of a second.

Values to change

NameFileDefaultWhat it changes
CITYscript.js'Lisbon'The city of the search, in the title.
GRAVITYscript.js2600The gravity of the flight from the filter to the bar: higher and the arc is taller and sharper.
FLIGHTscript.js0.52The seconds a filter takes to fly to the bar.
KICKscript.js340The push to the left with which a filter lands and hits the ones already in the bar.
SLOPEscript.js700How hard the bar pushes the filters to the left, like a barely tilted tray.
FRICTIONscript.js5The bar’s friction: higher and the filters stop sooner.
BOUNCEscript.js0.35How much the filters bounce when they collide (0 none, 1 fully).
TILTscript.js1How much the filters tilt in collisions and in flight (0 not at all).
HOLDscript.js1The drawn pointer’s pauses between one gesture and the next, in seconds.

Try them in the Playground

When to use it

For the search of a property site, a marketplace, a shop with many filters or a booking app: wherever the chosen filters gather in a bar, the physics shows where the choice went and makes removing and adding them pleasant.

On phones

The same animation with adapted sizes: the card is almost as wide as the screen, the chips and the button get shorter on short screens, and fewer filters fit in the first row, so the second is used sooner; everything works with a finger.

With reduced motion

No flights, collisions or tilting: the chips fade in already in their place in the line, and removing one makes the others jump into place; the number changes without rolling and there is no pointer.

Pitfalls

  • The chip has one element for the physics (its transform is written by the code every frame) and an inner one for the CSS: if hover changed the transform of the same element, the physics would wipe it out.
  • In the list the filters have their hover in CSS: the filter’s little taps (the shake and the return) use the translate and scale properties through the Web Animations API, never GSAP, which would write its transform over the class’s.
  • The place in the line is reserved at launch, not on landing: that way two filters picked in a row do not fight over the same space, and a chip in flight takes no part in collisions until it touches the bar.
  • On resize the chips are lined up again at the new size: the bar changes width and a chip could end up past the edge.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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