Skip to content
animorio
IT
All components

Glass Enhance button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 8.6 KBGSAP 28 KBFreeDownload the zip

The Enhance button of an app that improves photos with artificial intelligence, made of frosted glass on black, like a Dribbble shot: under the glass a violet and a cyan drift slowly, the top edge catches the light and the button throws a coloured glow beneath itself. On hover a comet of light runs around the edge and a soft light follows the pointer; pressed, the glass gives and springs back, and the comet becomes the progress of the job: it starts at the top centre and traces the edge as far as the job has gone, with the percentage counting. At 100 the edge closes, flashes, a reflection crosses the glass and the words become Enhanced with a check and 4K.

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 Enhance button" 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 glass Enhance button with the progress on its edge</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 Enhance button of an AI photo tool, made of frosted glass over two slow colours. On hover a comet of light
         runs around its edge and a soft light follows the pointer inside the glass; pressed, the comet stops being a
         lap and becomes the progress: it traces the edge from the top, as far as the job has gone, with the
         percentage beside it. At 100% the edge closes, flashes once, a reflection crosses the glass and the button
         says Enhanced with a check that draws itself -->
    <div class="eb" data-wrap>
      <span class="eb__spill" data-spill aria-hidden="true"></span>
      <button class="eb__btn" type="button" data-btn aria-label="Enhance photo, uses 2 credits">
        <span class="eb__glass" data-glass>
          <span class="eb__tint" aria-hidden="true">
            <span class="eb__blob eb__blob--a" data-blob></span>
            <span class="eb__blob eb__blob--b" data-blob></span>
          </span>
          <span class="eb__frost" aria-hidden="true"></span>
          <span class="eb__shine" data-shine aria-hidden="true"></span>
          <span class="eb__sweep" aria-hidden="true"><span class="eb__sweep-band" data-sweep></span></span>
          <svg class="eb__edge" data-edge aria-hidden="true">
            <defs>
              <linearGradient id="eb-grad" data-grad gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="240" y2="0">
                <stop offset="0" stop-color="var(--violet)"/>
                <stop offset="0.5" stop-color="var(--cyan)"/>
                <stop offset="1" stop-color="var(--violet)"/>
              </linearGradient>
              <filter id="eb-blur" data-filter filterUnits="userSpaceOnUse" x="-40" y="-40" width="320" height="140">
                <feGaussianBlur stdDeviation="3.6"/>
              </filter>
            </defs>
            <path class="eb__track" data-track/>
            <g class="eb__glow" data-glow filter="url(#eb-blur)"></g>
            <path class="eb__done" data-done/>
            <g class="eb__comet" data-comet></g>
          </svg>
          <span class="eb__row">
            <span class="eb__icon" aria-hidden="true">
              <svg viewBox="0 0 24 24">
                <g data-spark>
                  <path class="eb__spark" d="M12 3.2c.5 4.3 2.5 6.3 6.8 6.8-4.3.5-6.3 2.5-6.8 6.8-.5-4.3-2.5-6.3-6.8-6.8 4.3-.5 6.3-2.5 6.8-6.8z"/>
                  <path class="eb__spark eb__spark--s" data-spark-s d="M18.6 14.6c.2 1.7 1 2.5 2.7 2.7-1.7.2-2.5 1-2.7 2.7-.2-1.7-1-2.5-2.7-2.7 1.7-.2 2.5-1 2.7-2.7z"/>
                </g>
                <path class="eb__check" data-check pathLength="1" d="M5.6 12.6l4.1 4.1 8.6-9.2"/>
              </svg>
            </span>
            <span class="eb__labels" aria-hidden="true">
              <span class="eb__label" data-label>Enhance</span>
              <span class="eb__label eb__label--busy" data-label>Enhancing</span>
              <span class="eb__label" data-label>Enhanced</span>
            </span>
            <span class="eb__chip" aria-hidden="true">
              <span class="eb__chip-face" data-chip>2 cr</span>
              <span class="eb__chip-face" data-chip><span data-pct>0</span>%</span>
              <span class="eb__chip-face" data-chip>4K</span>
            </span>
          </span>
        </span>
      </button>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

27 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 Enhance button” 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 black, alone in the middle, there is a pill button 60 pixels tall, made of frosted glass: behind the glass two blurred patches, one violet and one cyan, drift slowly back and forth; on the glass sits a very fine grain, the top edge catches the light in one pixel and the bottom one stays in shadow, and under the button the floor takes a violet glow. Inside, the four point sparkle with a small cyan star, the word Enhance and a small glass capsule with the cost, «2 cr». With the mouse over it, a soft light follows the pointer inside the glass and a comet of light starts running around the edge, with a white head and a tail fading from cyan to violet. Pressed, the glass sinks by a pixel and narrows a little, the colours under it swell, and on release it springs back. Then the comet goes out and starts again from the top centre as the progress: it traces the edge clockwise exactly as far as the job has gone, fast at first, then slowing and almost stopping near 70, then rushing to the end, while the percentage counts in the capsule, the word becomes Enhancing with a band of light passing through it, the sparkle turns and the small star twinkles, and the colours under the glass run faster. At 100 the edge closes into a full ring, flashes once and stays lit, the glass swells by a hair, a diagonal reflection crosses it from left to right, the sparkle folds away and a light green check draws itself in its place; the word becomes Enhanced and the capsule says 4K. After a moment the edge goes out, the sparkle comes back with a springy turn and the button is ready again. Until someone touches it, the button goes round by itself.

How it works

Glass in three layers

The button is a single box with three absolute layers: at the bottom two colour patches blurred with filter: blur, which GSAP drifts back and forth with xPercent; above them a pane with backdrop-filter, a gradient from the top, a feTurbulence grain in an SVG used as background image and three inner shadows (the one pixel edge, the light at the top, the shadow at the bottom); on top a radial-gradient that follows the pointer through two CSS variables moved by gsap.quickTo.

The edge is one path

One pill shaped SVG path that starts at the top centre and runs clockwise, rebuilt on every resize by a ResizeObserver; getTotalLength gives its length L. The same path is the track, the progress, the glow and the comet: only strokeDasharray and strokeDashoffset change.

The comet in slices

The tail is fourteen copies of the path, each a dash one fourteenth of the tail long and more transparent going back, plus a short white head; a thicker copy of each slice goes through a feGaussianBlur and is the glow. With a dash of len and a gap of L minus len, the offset modulo L carries the comet past the start without a jump.

From lap to progress

On click the comet fades out in 0.16 seconds, starts again from zero with a short tail and from then on its head is the job’s value: a GSAP timeline in four stretches (fast to 34, calmer to 71, almost still to 77, power3.in to 100) moves the head, the progress and the percentage together. While loading the tail is clipped at zero, so it never goes back past the start.

The success

At 100 the comet shortens to nothing, the progress becomes a full ring (dasharray none), the glow rises to 1 in 0.14 seconds and settles at a fifth; the glass goes to 1.018 and comes back on an elastic spring, a slanted band of light crosses it with xPercent, the sparkle folds with scale and the check draws itself with pathLength 1 and strokeDashoffset.

Values to change

NameFileDefaultWhat it changes
LABEL_RESTscript.jsEnhanceThe word at rest.
LABEL_BUSYscript.jsEnhancingThe word while the job runs.
LABEL_DONEscript.jsEnhancedThe word at the end.
COSTscript.js2 crThe capsule at rest: what the job costs.
RESULTscript.js4KThe capsule at the end: what came out.
DURATIONscript.js2.9How many seconds the job takes, from 0 to 100.
LAPscript.js1.9How many seconds one lap of the comet takes on hover.
TAILscript.js0.26How long the comet’s tail is, as a share of the edge.
GLOWscript.js1How strong the glow on the edge is.
SPRINGscript.js1How springy the press is: 0.4 calm, 2 very bouncy.
HOLDscript.js1.6How many seconds Enhanced stays before going back to rest.
AUTOscript.jstrueThe button goes round by itself until someone touches it.

Try them in the Playground

When to use it

For the main action of an AI app that works for a few seconds: enhancing or upscaling a photo, generating an image, summarising a document. The edge filling up tells how far it has gone without an extra bar, and the button stays the place to look.

On phones

On the phone the button is at most 80% of the screen wide and the edge redraws to its size; there is no hover, so the light under the finger turns on at the touch and the rest, progress included, is the same.

With reduced motion

Nothing moves: the colours under the glass stay still, there is no comet, the edge fades in as the percentage rises, the words and the capsule swap in place and the check fades in.

Pitfalls

  • With a single dash and a gap as long as the path, the comet vanished for an instant on every lap as it crossed the start: the gap is L minus the dash, so the pattern repeats exactly every L and the offset modulo L carries it past the start without holes.
  • While loading, the comet’s tail resting on zero reached back past the start and lit the end of the edge as if the job were already done: in that phase the slices are clipped at zero.
  • At 100% the progress drawn with a dash left a tenth of a pixel gap at the top centre: when the job is done the dasharray becomes none and the ring is closed.
  • The glow filter with the default region cut the light on the curved ends: the region is in userSpaceOnUse and grows by 40 pixels on each side at every resize.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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