Skip to content
animorio
IT
Back to the library

Spotlight cards

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

The features section of a deploy platform, on near black: six cards in a grid and one soft, wide light that follows the pointer with a small lag, lighting the thin border of the cards it crosses and, faintly, their background. The card under the pointer lifts by a pixel, its icon redraws itself and a small chevron appears; on the way out the light slowly fades.

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>
<!--
  "Spotlight cards" 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>Cards lit by a light that follows the pointer</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 features section of a deploy platform: one soft light follows the pointer over the whole grid and lights
         the thin borders of the cards it passes; the card under the pointer lifts a pixel and draws its icon -->
    <section class="features" aria-labelledby="titolo">
      <header class="head">
        <p class="eyebrow">Sendra platform</p>
        <h1 class="title" id="titolo">Everything ships from one place</h1>
      </header>

      <div class="grid" data-grid>
        <article class="card" data-card tabindex="0">
          <span class="icon" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path pathLength="1" d="M13 2.8 5.2 13.4h5.9L10.4 21.2l8.4-11h-6.1z"/></svg>
          </span>
          <h2 class="card__title">Instant deploys <svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></h2>
          <p class="card__text">Push to main and it is live in eleven seconds.</p>
        </article>
        <article class="card" data-card tabindex="0">
          <span class="icon" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path pathLength="1" d="M12 3.2a8.8 8.8 0 1 0 0 17.6 8.8 8.8 0 1 0 0-17.6zM3.4 12h17.2M12 3.2c2.4 2.4 3.6 5.3 3.6 8.8s-1.2 6.4-3.6 8.8c-2.4-2.4-3.6-5.3-3.6-8.8S9.6 5.6 12 3.2z"/></svg>
          </span>
          <h2 class="card__title">Edge cache <svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></h2>
          <p class="card__text">Pages served from 38 regions, close to every visitor.</p>
        </article>
        <article class="card" data-card tabindex="0">
          <span class="icon" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path pathLength="1" d="M10.2 13.8a4.2 4.2 0 0 0 6 0l3-3a4.2 4.2 0 0 0-6-6l-1.1 1.1M13.8 10.2a4.2 4.2 0 0 0-6 0l-3 3a4.2 4.2 0 0 0 6 6l1.1-1.1"/></svg>
          </span>
          <h2 class="card__title">Preview links <svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></h2>
          <p class="card__text">Every branch gets its own address to share.</p>
        </article>
        <article class="card" data-card tabindex="0">
          <span class="icon" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path pathLength="1" d="M4.2 12a7.8 7.8 0 1 0 2.3-5.5L4.2 8.8M4.2 3.9v4.9h4.9M12 8v4.4l2.8 1.8"/></svg>
          </span>
          <h2 class="card__title">One-click rollback <svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></h2>
          <p class="card__text">Go back to any of the last 50 releases.</p>
        </article>
        <article class="card card--more" data-card tabindex="0">
          <span class="icon" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path pathLength="1" d="M6.2 16.6V11a5.8 5.8 0 0 1 11.6 0v5.6l1.8 2H4.4zM9.8 18.6a2.2 2.2 0 0 0 4.4 0"/></svg>
          </span>
          <h2 class="card__title">Usage alerts <svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></h2>
          <p class="card__text">A note before you reach your monthly limit.</p>
        </article>
        <article class="card card--more" data-card tabindex="0">
          <span class="icon" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path pathLength="1" d="M6 3.4h8.6l3.8 3.8v13.4H6zM14.4 3.4v4h4M8.8 11.4h6.6M8.8 14.6h6.6M8.8 17.8h4"/></svg>
          </span>
          <h2 class="card__title">Audit log <svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></h2>
          <p class="card__text">Who changed what, kept for twelve months.</p>
        </article>
      </div>
    </section>

    <!-- the fake pointer of the autopilot -->
    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 12l-6.3 1.5-3.4 5.8z"/></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.

26 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 “Spotlight cards” 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 near black background sits the features section of a made-up platform, Sendra: a small violet line, the headline Everything ships from one place, and below six dark cards with wide corners and a barely visible border. Each has a line icon in a small square, a title and a grey line: Instant deploys, Edge cache, Preview links, One-click rollback, Usage alerts, Audit log. When the pointer enters the grid a single violet light turns on, about 260 pixels wide, following it with a soft lag: where it passes, the thin border of the cards becomes a fading line of light, the cards’ background takes a faint tint and even the gap between them gets a glow. The card under the pointer lifts by a pixel with a small shadow, its icon redraws stroke by stroke and turns white, and a chevron slides in next to the title. Pressed, the card squeezes a touch and springs back. Leaving the grid, the light fades in six tenths of a second. In the autopilot a drawn pointer goes round the cards, presses one and leaves.

How it works

One light for the whole grid

The light’s position lives in two CSS variables on the grid, --x and --y. Every frame the script hands it to each card minus the card’s own position (--cx, --cy), so each card draws its share of the same light with a radial-gradient: neighbouring cards light up together, as under a real spotlight.

A border cut out of the light

The glowing border is a pseudo-element as big as the card with one pixel of padding: inside it is the light’s gradient, and a mask with mask-composite exclude removes everything but that pixel. A second pseudo-element paints the fill, wider and much fainter.

The soft lag

The light does not jump onto the pointer: every frame it covers part of the remaining distance, 1 minus LIGHT_LAG raised to the elapsed time, so the lag is the same at 60 and 120 frames per second. Turning on and off is a tween on the opacity, --a.

The card under the pointer

The card holding the point is found from its offsetLeft and offsetTop inside the grid. When it changes, the old one settles down with power3.out and the new one rises by LIFT pixels with back.out, the icon redraws from stroke-dashoffset 1 to 0 (pathLength 1) and the chevron slides in from the left.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js'#8b7cff'The colour of the light, on the border and inside the cards.
LIGHT_SIZEscript.js260How wide the light is, in pixels.
LIGHT_LAGscript.js0.86How far the light lags behind the pointer (0 = it follows at once).
BORDER_GLOWscript.js1How bright the thin border of the cards gets.
FILL_GLOWscript.js1How much the cards’ background lights up under the light.
LIFTscript.js1How many pixels the card under the pointer lifts.
FADEscript.js0.6How many seconds the light takes to fade on the way out.

Try them in the Playground

When to use it

For the features or pricing section of a software product, a developer tool or an AI app on a dark background: the light tells visitors the cards can be touched without extra buttons.

On phones

The same light, with touch instead of hover: tapping a card brings the light onto it and lifts it. The cards become four on two columns, so they all fit in the box.

With reduced motion

The light does not chase: it appears straight on the card and fades in and out. The cards do not lift and the icons are already drawn.

Pitfalls

  • One light per card would draw a halo cut off at each card’s edge: the position has to be one, the grid’s, and each card subtracts its own.
  • mask-composite also needs the prefixed form (-webkit-mask-composite: xor) for Safari.
  • A lag computed with a fixed number per frame runs twice as fast on a 120 Hz screen: it has to be raised to the elapsed time.
  • On phones a tap sends no pointermove between taps: the light must also move on pointerdown.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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