Skip to content
animorio
IT
All components

Glass lens dashboard tabs

Tabs, Transitions, SVGGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The card of an analytics dashboard for an AI writing app, dark on black, like a Dribbble shot. On top four tabs, Overview, Revenue, Users and AI usage: over the active one a lens of liquid glass runs on a spring from tab to tab, stretches while it runs, settles and slightly magnifies and bends the label under it, with a highlight sliding inside the glass. Below, the content changes in the lens's direction: the figure rolls on drums, the chart line draws itself and the bars fill.

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 lens dashboard tabs" 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 dashboard tabs with the sliding glass lens</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 analytics card of an AI writing assistant (Fernlight, invented). Over the active tab a lens of liquid glass
         slides on a spring, stretches while it runs and settles; under it the words are magnified and bent at the
         edges, a highlight catches the light. Below, the content of the tab changes in the direction of travel -->
    <section class="dash" data-dash aria-label="Fernlight analytics">
      <span class="dash__grain" data-grain aria-hidden="true"></span>
      <span class="dash__sheen" aria-hidden="true"></span>

      <header class="dash__head">
        <span class="dash__brand">
          <svg class="dash__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M10 2.2c.6 3.9 3.9 7.2 7.8 7.8-3.9.6-7.2 3.9-7.8 7.8-.6-3.9-3.9-7.2-7.8-7.8 3.9-.6 7.2-3.9 7.8-7.8z"/>
          </svg>
          <span>Fernlight</span>
          <span class="dash__crumb">Analytics</span>
        </span>
        <button class="dash__range" type="button">
          <span>Last 30 days</span>
          <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 4.6l3 3 3-3"/></svg>
        </button>
      </header>

      <div class="tabs" data-tabs>
        <div class="tabs__track" role="tablist" aria-label="Analytics views" data-track>
          <button class="tabs__tab" type="button" role="tab" id="tab-overview" aria-controls="pane-overview" aria-selected="true" tabindex="0" data-tab>Overview</button>
          <button class="tabs__tab" type="button" role="tab" id="tab-revenue" aria-controls="pane-revenue" aria-selected="false" tabindex="-1" data-tab>Revenue</button>
          <button class="tabs__tab" type="button" role="tab" id="tab-users" aria-controls="pane-users" aria-selected="false" tabindex="-1" data-tab>Users</button>
          <button class="tabs__tab" type="button" role="tab" id="tab-ai" aria-controls="pane-ai" aria-selected="false" tabindex="-1" data-tab>AI usage</button>

          <span class="lens" data-lens aria-hidden="true">
            <span class="lens__glass" data-glass>
              <span class="lens__bend">
                <span class="lens__text" data-lens-text>
                  <span>Overview</span><span>Revenue</span><span>Users</span><span>AI usage</span>
                </span>
              </span>
            </span>
            <span class="lens__rim"></span>
            <span class="lens__shine" data-shine></span>
          </span>
        </div>
      </div>

      <div class="panes" data-panes>
        <section class="pane" role="tabpanel" id="pane-overview" aria-labelledby="tab-overview" data-pane>
          <p class="pane__label" data-part>Active workspaces</p>
          <div class="pane__figure" data-part>
            <span class="num" data-num="12,480">12,480</span>
            <span class="delta"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 7.6l3-3 3 3"/></svg>8.2%</span>
          </div>
          <div class="chart" data-part data-chart data-points="38 42 40 47 45 52 50 55 61 58 64 70 68 74 79 77 84"></div>
          <ul class="rows" data-part>
            <li class="row"><span class="row__name">Prompts today</span><span class="row__bar"><i data-w="0.82"></i></span><b class="row__val">48.2k</b></li>
            <li class="row"><span class="row__name">Median reply</span><span class="row__bar"><i data-w="0.46"></i></span><b class="row__val">1.4 s</b></li>
            <li class="row"><span class="row__name">Uptime</span><span class="row__bar"><i data-w="0.97"></i></span><b class="row__val">99.98%</b></li>
          </ul>
        </section>

        <section class="pane" role="tabpanel" id="pane-revenue" aria-labelledby="tab-revenue" hidden data-pane>
          <p class="pane__label" data-part>Monthly recurring revenue</p>
          <div class="pane__figure" data-part>
            <span class="num" data-num="$184,920">$184,920</span>
            <span class="delta"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 7.6l3-3 3 3"/></svg>12.4%</span>
          </div>
          <div class="chart" data-part data-chart data-points="30 33 31 38 44 41 49 53 52 60 63 61 69 75 73 82 90"></div>
          <ul class="rows" data-part>
            <li class="row"><span class="row__name">Pro plans</span><span class="row__bar"><i data-w="0.74"></i></span><b class="row__val">$96.4k</b></li>
            <li class="row"><span class="row__name">Team plans</span><span class="row__bar"><i data-w="0.56"></i></span><b class="row__val">$71.2k</b></li>
            <li class="row"><span class="row__name">API</span><span class="row__bar"><i data-w="0.18"></i></span><b class="row__val">$17.3k</b></li>
          </ul>
        </section>

        <section class="pane" role="tabpanel" id="pane-users" aria-labelledby="tab-users" hidden data-pane>
          <p class="pane__label" data-part>Weekly active users</p>
          <div class="pane__figure" data-part>
            <span class="num" data-num="31,604">31,604</span>
            <span class="delta"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 7.6l3-3 3 3"/></svg>5.1%</span>
          </div>
          <div class="chart" data-part data-chart data-points="55 58 54 60 63 59 62 66 64 68 65 70 72 69 73 76 75"></div>
          <ul class="rows" data-part>
            <li class="row"><span class="row__name">New sign-ups</span><span class="row__bar"><i data-w="0.38"></i></span><b class="row__val">2,318</b></li>
            <li class="row"><span class="row__name">Kept after 30 days</span><span class="row__bar"><i data-w="0.74"></i></span><b class="row__val">74%</b></li>
            <li class="row"><span class="row__name">Teams</span><span class="row__bar"><i data-w="0.52"></i></span><b class="row__val">1,946</b></li>
          </ul>
        </section>

        <section class="pane" role="tabpanel" id="pane-ai" aria-labelledby="tab-ai" hidden data-pane>
          <p class="pane__label" data-part>Tokens this month</p>
          <div class="pane__figure" data-part>
            <span class="num" data-num="2.84B">2.84B</span>
            <span class="delta"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 7.6l3-3 3 3"/></svg>21.7%</span>
          </div>
          <div class="chart" data-part data-chart data-points="20 24 29 27 35 41 39 48 55 52 61 67 72 70 79 86 93"></div>
          <ul class="rows" data-part>
            <li class="row"><span class="row__name">Assistant</span><span class="row__bar"><i data-w="0.57"></i></span><b class="row__val">1.62B</b></li>
            <li class="row"><span class="row__name">Search</span><span class="row__bar"><i data-w="0.29"></i></span><b class="row__val">0.81B</b></li>
            <li class="row"><span class="row__name">Agents</span><span class="row__bar"><i data-w="0.14"></i></span><b class="row__val">0.41B</b></li>
          </ul>
        </section>
      </div>
    </section>

    <!-- the bend of the glass: a displacement map drawn by script.js pushes the words outwards near the lens' rim -->
    <svg class="defs" width="0" height="0" aria-hidden="true" focusable="false">
      <filter id="lens-bend" x="0" y="0" width="1" height="1" color-interpolation-filters="sRGB" primitiveUnits="objectBoundingBox">
        <feImage data-map x="0" y="0" width="1" height="1" preserveAspectRatio="none" result="map"/>
        <feDisplacementMap in="SourceGraphic" in2="map" scale="0.06" xChannelSelector="R" yChannelSelector="G"/>
      </filter>
    </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.

65 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 lens dashboard tabs” 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 black page a dark card rises, with round corners, a thin edge catching the light at the top and a light grain: at the top the Fernlight brand with its purple star, the word Analytics and the ‘Last 30 days’ pill. Below sits a dark well with four tabs, Overview, Revenue, Users and AI usage. Over Overview a glass lens settles: a light slab whose rim catches the light at the top, with a purple thread at the bottom and a highlight; the label under the lens is whiter, a little magnified and curved towards the edges as if seen through thick glass. Under the tabs is the content: the label, a big figure rolling on drums up to 12,480, the purple +8.2% chip with its arrow, a purple line chart drawing itself over a gradient and three rows whose bars fill. Every few seconds another tab is chosen: the lens runs there on a spring, stretching and thinning with its speed, the highlight sliding back inside the glass, passes the mark by a pixel and settles with a little press bounce. The old content leaves blurred to the opposite side, the new one comes in from the side the lens comes from, piece after piece. The walk goes to Revenue, Users, AI usage, back to Revenue and Overview, and starts again. The tabs can be clicked and used with the arrow keys, and on the chart a thin cursor shows the value of the day.

How it works

A spring written by hand

The lens is not driven by a tween: its centre and width chase the chosen tab on a spring integrated every frame (stiffness 210, damping 19, two steps per frame, a step of at most 1/30 s). A click halfway through turns it around without a jump.

It stretches with speed

Every frame the drawn width is the spring's plus the speed times STRETCH, and the height loses a few pixels: the lens stretches and thins while it runs and turns round again when it stops. A separate tween does the press, 0.08 s down and an elastic back.

The copy of the labels inside the glass

Inside the lens sits a copy of the four labels, as wide as the well and laid out the same way; it moves opposite to the lens so it lines up with the real ones, and it is scaled around the lens's centre. The glass has a solid body, so it covers the real labels: only the copy shows, bigger and brighter.

The bend at the rim

The glass has an SVG feDisplacementMap filter with a map drawn once on a canvas: neutral in the middle and stronger towards the edges (cubed), in bounding-box units, so it follows the lens even while it changes width. Letters near the rim are sampled from further out: they squeeze and curve as under the edge of thick glass, and never spill past the lens.

Content that follows the direction

The sign of the difference between the new tab and the old gives the way: the pieces of the old content leave to one side with a little blur, the new ones come in from the other, staggered by 0.05 s. The figure rolls on drums of two rounds of digits, the chart line and its gradient are uncovered from the left by a clipping rect, followed by a thread of light and the bars grow with scaleX.

Values to change

NameFileDefaultWhat it changes
STIFFNESSscript.js210The spring pulling the lens to its tab: higher is quicker.
DAMPINGscript.js19Lower lets the lens pass the mark and come back.
STRETCHscript.js0.05How much the lens stretches with its speed.
MAGNIFYscript.js1.12How much the glass magnifies the label under it.
BENDscript.js0.06How much the rim of the glass bends the letters.
SLIDEscript.js26How many pixels the content slides when it changes.
DWELLscript.js2.6The seconds the walk on its own stays on a tab.
LOOPscript.jstrueRepeats the walk through the tabs.

Try them in the Playground

When to use it

For the dashboard of an AI app, a SaaS, an online shop or a subscription service: the tabs switching views in a stats card, and any group of tabs on top of a panel where the chosen tab should feel like a real object.

On phones

The same animation with adapted sizes: the card is 92% of the screen wide, the tab labels shrink, the chart and the rows get lower with the height (below 460 pixels two rows remain) and the tabs are chosen with a finger; on the chart the cursor follows the finger.

With reduced motion

The lens does not run: it appears at once on the new tab with a fade, the content changes with a fade without sliding, the figure, the line and the bars are already in place.

Pitfalls

  • A blurring backdrop-filter over the tabs cost too much every frame and slowed the video down: the refraction is a copy of the labels magnified and clipped inside the lens, plus only a small feDisplacementMap on the glass.
  • With vector-effect non-scaling-stroke Chrome gets pathLength dashes wrong and the line stopped halfway: the chart is uncovered by a clipping rect, not by dashes.
  • A filter on the glass itself drew square corners over the round ones: the filter sits on a layer inside the glass, which clips it afterwards.
  • A bend map in pixels would have to be redrawn every time the lens changes width: with primitiveUnits objectBoundingBox the map and its strength follow the box by themselves.
  • A panel hidden with display none has no size and overlaps badly: the panels all sit in the same grid cell, the ones out of view are only invisible, and the card keeps the height of the tallest without jumping.
  • Mona Sans digits are not fixed width: each drum sits over an invisible digit, the final one, so the figure keeps its true spacing and not that of tabular figures.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 5 November 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