Skip to content
animorio
IT
All components

Glass drop view switcher

Pickers, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.6 KBGSAP 28 KBFreeDownload the zip

A project card in a team app, on very light grey: on top a List, Board and Calendar switcher, and over the chosen view a drop of glass that magnifies its label like a lens. Changing view, the drop slides and stretches, magnifying a little more as it runs, and the six tasks below lift, fly to their place in the new view (rows, To do, Doing and Done columns, days of the week) and settle on a spring.

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 drop view switcher" 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 view switcher with a glass drop and tasks that rearrange</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">
    <!-- a project card with a List / Board / Calendar switcher: the chosen view sits under a drop of glass that
         magnifies its label, and the six tasks below really move to their place in the new view -->
    <section class="card" data-card aria-label="Tallyroom sprint">
      <header class="card__head">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="4"></rect><path d="M7 8h6M7 12h3.5"></path></svg>
          <span class="brand__name">Tallyroom</span>
        </span>
        <span class="card__meta"><span data-count>6 tasks</span> in Launch week</span>
      </header>

      <div class="seg" role="radiogroup" aria-label="View" data-seg>
        <span class="seg__drop" data-drop aria-hidden="true">
          <span class="seg__lens" data-lens></span>
          <span class="seg__shine"></span>
        </span>
        <button class="seg__opt" type="button" role="radio" aria-checked="true" tabindex="0" data-opt="0">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.5 4.5h7M5.5 8h7M5.5 11.5h7"></path><path d="M3 4.5h.01M3 8h.01M3 11.5h.01"></path></svg>
          <span>List</span>
        </button>
        <button class="seg__opt" type="button" role="radio" aria-checked="false" tabindex="-1" data-opt="1">
          <svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2.5" y="3" width="3" height="10" rx="1"></rect><rect x="6.5" y="3" width="3" height="7" rx="1"></rect><rect x="10.5" y="3" width="3" height="5" rx="1"></rect></svg>
          <span>Board</span>
        </button>
        <button class="seg__opt" type="button" role="radio" aria-checked="false" tabindex="-1" data-opt="2">
          <svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2.5" y="3.5" width="11" height="10" rx="2"></rect><path d="M2.5 6.5h11M5.5 2v3M10.5 2v3"></path></svg>
          <span>Calendar</span>
        </button>
      </div>

      <div class="view" data-view>
        <div class="heads" data-heads aria-hidden="true"></div>
        <div class="grid" data-grid aria-hidden="true"></div>
      </div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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>

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.

23 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 drop view switcher” 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 very light grey background sits the white card of Tallyroom, an invented team app, with a product’s launch week: at the top the name and how many tasks there are, below a grey track with three options, List, Board and Calendar, each with its drawn icon, and over the chosen one a white drop of glass, with a bright rim on top and a soft shadow. Under the drop the label looks bigger, as through a lens, with a hint of red and blue along the letters and the icon in the accent colour. Below are six tasks, each with its status bar (grey to do, blue in progress, black done, with a check), the title and the initials of who is on it. Picking Board the drop slides: the front edge leaves first, the back one follows, so it stretches, squeezes slightly in height, magnifies a little more as it runs and settles one pixel too far. Meanwhile the tasks lift one after the other, with a bigger shadow, and fly into the three columns To do, Doing and Done, which appear behind them with their numbers; with Calendar they shrink into the five days from Monday to Friday, and with List they become rows again. The line at the top rolls from 6 tasks to 2 in progress and to the dates of the week. With a mouse the drop leans a few pixels towards the pointer, as if pulled by a magnet; pressing squeezes it and lets it spring back. A drawn pointer tries Board, Calendar and goes back to List; it also really works, with touch and the arrow keys.

How it works

A lens made of a copy

Inside the drop sits a second row of the three options, the same as the first but in black and with the coloured icon. The drop has overflow hidden and moves; the copy inside moves the opposite way by the same amount, so it stays still against the track, and is magnified by LENS around the drop’s centre: what you see in the drop is the label beneath, bigger.

Two edges and one pixel too far

The drop has no position but two edges in an object animated by GSAP; the edge facing the new option leaves at once, the other a moment later (STRETCH), both arrive one pixel past and a half spring puts them back exactly. The same object also holds the magnification, which rises as it runs and comes back on an elastic spring.

Every view is a list of rectangles

For each view a function works out, from the box size, where every task goes: x, y, width and height. Changing view every task goes to its rectangle with back.out, staggered by STAGGER in the direction the drop runs; in the narrow views the is-small class drops the initials halfway through the flight.

Lift, fly, settle

While flying each task grows by three per cent and takes a wider shadow, then settles; the title inside arrives a little late, as if dragged. The columns and days behind appear from the top in a row, the old ones rise away.

The magnet and the measure

With a mouse over the track the drop leans at most three pixels towards the pointer. Everything is recomputed on resize, even mid-change: the drop finishes its run and the tasks go straight to the new rectangles.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2563ebThe colour of tasks in progress, of the icons under the drop and of the mark.
LENSscript.js1.14How much the glass drop magnifies the label beneath it.
STRETCHscript.js1How much the drop stretches as it slides.
SLIDE_TIMEscript.js0.46The seconds the drop takes to reach the new option.
MOVE_TIMEscript.js0.7The seconds each task takes to reach its place in the new view.
STAGGERscript.js0.045The seconds between one task and the next.
PAUSEscript.js2The seconds the autopilot stays on each view.

Try them in the Playground

When to use it

For the List, Board and Calendar views of a project or task app, the List and Grid views of a catalogue or a file library, any short switcher that changes how the same items are shown.

On phones

The card takes the full width minus the margin and the task box is sized on the height, so the three views fit the box. In narrow columns and days the initials disappear and the title is cut with an ellipsis. Touch picks like a click; the magnet only works with a mouse.

With reduced motion

The drop fades out and back in on the new option, the tasks fade out and back in already in place, the columns and days fade in.

Pitfalls

  • The copy of the labels inside the drop must move opposite to the drop and be magnified around the drop’s centre, not its own: otherwise the magnified label slides away from the real one.
  • Animating the tasks’ width and height makes the text inside reflow every frame: fine for six items, for a long list better use scale and a container with the final size.
  • The view rectangles depend on the window height: on resize they must be recomputed and the tasks put back at once, even mid-flight.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 28 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 components