Skip to content
animorio
IT
All components

Shadow editor

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

A box-shadow editor in a card on white: a white tile on a grey floor and a light to drag all around it. The shadow stretches away on the opposite side and catches up with the light on a spring, and the edge of the tile facing the light brightens. Below, softness on a slider, one to three layers and the CSS rewriting itself at every move, ready to copy with a tap.

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>
<!--
  "Shadow editor" 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>Shadow editor</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 box-shadow editor: a light to drag around a tile, the shadow stretching away from it in layers,
         softness and layer count to set, and the CSS rewriting itself underneath -->
    <section class="se" data-se aria-label="Shadow editor">
      <header class="se__head">
        <strong>Shadow</strong>
        <button type="button" class="se__copy" data-copy>
          <svg viewBox="0 0 16 16" aria-hidden="true"><rect class="se__sheet" x="5.500" y="5.500" width="8" height="8" rx="2"></rect><path class="se__sheet" d="M10.500 3.200V3a1 1 0 0 0-1-1H3.500a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h.200"></path><path class="se__tick" pathLength="1" d="M3.400 8.400 6.600 11.500 12.700 4.800"></path></svg>
          <span class="se__copyclip"><span data-outcopy>Copy CSS</span></span>
        </button>
      </header>

      <div class="se__view" data-view>
        <svg class="se__ray" data-ray aria-hidden="true"><line data-rayline x1="0" y1="0" x2="0" y2="0"></line></svg>
        <div class="se__lift" data-lift><div class="se__tile" data-tile></div></div>
        <button type="button" class="se__sun" data-sun aria-label="Light position. Arrow keys move the light."><span class="se__knob"><svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="3.400"></circle><path d="M10 2.200v2.300M10 15.500v2.300M2.200 10h2.300M15.500 10h2.300M4.500 4.500l1.600 1.600M13.900 13.900l1.600 1.600M4.500 15.500l1.600-1.600M13.900 6.100l1.600-1.600"></path></svg></span></button>
      </div>

      <label class="se__row">
        <span class="se__name">Softness</span>
        <input type="range" class="se__range" min="0" max="100" step="1" value="60" data-soft>
        <output class="se__val" data-outsoft>60</output>
      </label>
      <div class="se__row">
        <span class="se__name" id="se-layers">Layers</span>
        <div class="se__seg" role="radiogroup" aria-labelledby="se-layers" data-layers>
          <i class="se__thumb" data-thumb aria-hidden="true"></i>
          <button type="button" role="radio" aria-checked="false" data-n="1">1</button>
          <button type="button" role="radio" aria-checked="false" data-n="2">2</button>
          <button type="button" role="radio" aria-checked="true" data-n="3">3</button>
        </div>
      </div>

      <pre class="se__code" aria-label="CSS"><span class="se__prop">box-shadow:</span><span class="se__line" data-outline></span><span class="se__line" data-outline></span><span class="se__line" data-outline></span></pre>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

19 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Shadow editor” 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 white, a rounded card: “Shadow” and on the right the pill “Copy CSS”. Below, a light grey floor with a white round-cornered tile in the middle and, top left, a white circle with an amber sun: the light, joined to the tile by a dashed thread. The tile’s shadow falls bottom right, on the opposite side. Dragging the light (or tapping a point on the floor) turns and stretches the shadow with it, arriving a moment later and settling; the further the light, the longer and wider the shadow, and the edge of the tile facing the light picks up a bright line. Below, “Softness” with a slider and its number, and “Layers” with 1, 2 and 3 and the white thumb sliding onto the choice: at every change the tile settles. At the bottom, a dark box with the code: “box-shadow:” and one line per layer, the pixels in amber, rewriting as you drag. “Copy CSS” turns dark, with the tick drawing itself and “Copied”.

How it works

The light is a point

The light’s position runs from minus one to one on both axes, with the tile in the middle: it holds at any size of the floor.

The shadow chases it

A second point, the shadow’s, catches up with the light on a spring: the lag and the settling come from there.

The layers

Each layer is further, wider and fainter than the one before, on a squared curve: three light shadows make one truly soft shadow.

Same code

The string written onto the tile is the one shown in the box and the one copied: they cannot differ.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#f0a01eThe colour of the light.
REACHscript.js26How many pixels the shadow stretches when the light is at the edge.
DARKscript.js0.22How dark the shadow is.
LAGscript.js0.9How many seconds the shadow takes to catch up with the light and settle.
LOOPscript.jstrueLeft alone, the demo’s pointer drags the light, changes softness and layers and copies the CSS.

Try them in the Playground

When to use it

In the panel of a design app or a site builder, where a card’s shadow is chosen; in a design system’s documentation, on the elevation page; and in a developer tool that generates CSS. The same draggable light carries the angle of a gradient or the direction of an emboss.

On phones

The card is at most 348 pixels wide and about 350 tall; the floor gets shorter on short screens. The light has a 44-pixel hit area and drags under the finger without scrolling the page; the code stays on one line per layer.

With reduced motion

No springs or entrances: the shadow is at once where the light sends it, the layers thumb and the texts change in one step. The demo’s pointer does not start.

Pitfalls

  • The light also moves with the arrow keys (with Shift in longer steps), and every move is announced to screen reader users.
  • Softness is a real range input and the layers a radio group: keyboard and screen readers work with nothing more.
  • The floor has touch-action: none, otherwise on a phone the drag scrolls the page.
  • The shadows in the code are rounded to the pixel: the ones on the tile use the same numbers.
  • Copying to the clipboard can be refused by the browser: the demo tries and, if it cannot, only the label changes.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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