Skip to content
animorio
IT
Back to the library

Desk lamp scroll

Scroll, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.3 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

The product page of Moth, the table lamp of a made-up lighting studio, Tolvo: an opal glass dome on a brushed brass stem, on an oak desk in front of a window. Scrolling, the window blind lowers, the sky turns to evening and the room dims a little; then the lamp flickers on, the light fills the shade, falls in a soft cone and spreads on the desk with a small overshoot, showing the grain of the wood, and at last it warms from 2700 to 2200 K while the number rolls down. Beside it three short feature rows come in, then the price and the Add to bag pill.

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>
<!--
  "Desk lamp scroll" 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>Tolvo Moth, table lamp</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>
  <!-- the product page of a made-up lighting studio, Tolvo, for its table lamp Moth. A sticky stage: scrolling, the
       blind of the window behind lowers and the room dims, the lamp flickers on, the light opens on the oak desk and
       warms down to 2200 K, while three short feature rows come in beside it -->
  <section class="corsa" data-corsa>
    <div class="palco" data-palco>
      <div class="alone" data-alone aria-hidden="true"></div>

      <figure class="scena" data-scena>
        <svg viewBox="0 0 400 400" aria-label="The Moth lamp on an oak desk, in front of a window with a blind" role="img">
          <defs>
            <linearGradient id="cielo" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="#c9d7e2"/>
              <stop offset="0.65" stop-color="#ead9c9"/>
              <stop offset="1" stop-color="#f2cfae"/>
            </linearGradient>
            <pattern id="tela" width="6" height="4" patternUnits="userSpaceOnUse">
              <rect width="6" height="4" fill="#ede7dd"/>
              <path d="M0 3.5h6" stroke="#ddd5c8" stroke-width="0.6"/>
            </pattern>
            <linearGradient id="ottone" x1="0" y1="0" x2="1" y2="0">
              <stop offset="0" stop-color="#9c7a45"/>
              <stop offset="0.45" stop-color="#e2c48d"/>
              <stop offset="0.7" stop-color="#b8935a"/>
              <stop offset="1" stop-color="#86683a"/>
            </linearGradient>
            <linearGradient id="opale" x1="0" y1="0" x2="1" y2="1">
              <stop offset="0" stop-color="#fdfcfa"/>
              <stop offset="0.6" stop-color="#ebe7e0"/>
              <stop offset="1" stop-color="#d6d0c6"/>
            </linearGradient>
            <radialGradient id="acceso" cx="0.5" cy="1" r="0.95">
              <stop offset="0" style="stop-color:var(--luce)" stop-opacity="1"/>
              <stop offset="0.55" style="stop-color:var(--luce)" stop-opacity="0.75"/>
              <stop offset="1" style="stop-color:var(--luce)" stop-opacity="0.15"/>
            </radialGradient>
            <linearGradient id="cono" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" style="stop-color:var(--luce)" stop-opacity="0.5"/>
              <stop offset="1" style="stop-color:var(--luce)" stop-opacity="0"/>
            </linearGradient>
            <radialGradient id="pozza">
              <stop offset="0" style="stop-color:var(--luce)" stop-opacity="0.95"/>
              <stop offset="0.45" style="stop-color:var(--luce)" stop-opacity="0.5"/>
              <stop offset="1" style="stop-color:var(--luce)" stop-opacity="0"/>
            </radialGradient>
            <radialGradient id="maschera-pozza">
              <stop offset="0" stop-color="#fff"/>
              <stop offset="1" stop-color="#000"/>
            </radialGradient>
            <linearGradient id="rovere" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="#dccbb2"/>
              <stop offset="1" stop-color="#cdb898"/>
            </linearGradient>
            <linearGradient id="bordo-rovere" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="#bba183"/>
              <stop offset="1" stop-color="#a68a6a"/>
            </linearGradient>
            <linearGradient id="filo-luce" x1="0" y1="0" x2="1" y2="0">
              <stop offset="0" style="stop-color:var(--luce)" stop-opacity="0"/>
              <stop offset="0.5" style="stop-color:var(--luce)" stop-opacity="1"/>
              <stop offset="1" style="stop-color:var(--luce)" stop-opacity="0"/>
            </linearGradient>
            <clipPath id="vetro"><rect x="46" y="46" width="138" height="178"/></clipPath>
            <clipPath id="piano"><path d="M14 300 L386 300 L366 284 L34 284 Z"/></clipPath>
            <mask id="m-pozza"><ellipse data-maschera cx="270" cy="292" rx="0" ry="0" fill="url(#maschera-pozza)"/></mask>
            <filter id="morbido" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="5"/></filter>
          </defs>

          <!-- the window, its sky and the blind -->
          <g class="finestra">
            <rect x="40" y="40" width="150" height="190" rx="1.5" class="telaio"/>
            <rect x="46" y="46" width="138" height="178" fill="url(#cielo)"/>
            <rect x="46" y="46" width="138" height="178" class="sera" data-sera/>
            <path d="M115 46v178M46 135h138" class="montante"/>
            <g clip-path="url(#vetro)">
              <rect x="46" y="46" width="138" height="10" fill="url(#tela)" data-tenda/>
              <rect x="46" y="56" width="138" height="5" class="ombra-orlo" data-ombra-orlo/>
            </g>
            <rect x="44" y="54" width="142" height="4.5" rx="1.2" class="orlo" data-orlo/>
            <g data-cordino>
              <path d="M174 58.5v30" class="cordino"/>
              <rect x="171.6" y="88" width="4.8" height="9" rx="2.4" class="perlina"/>
            </g>
            <rect x="34" y="229" width="162" height="5" rx="1" class="davanzale"/>
          </g>

          <!-- the daylight shadow of the lamp on the wall, gone once the blind is down -->
          <g class="ombra-giorno" data-ombra-giorno filter="url(#morbido)">
            <path d="M232 172 C232 124, 346 124, 346 172 Z"/>
            <rect x="287" y="172" width="4" height="116"/>
          </g>

          <!-- the cone of light under the shade -->
          <path d="M214 178 L326 178 L384 292 L156 292 Z" fill="url(#cono)" class="cono" data-cono filter="url(#morbido)"/>

          <!-- the oak desk -->
          <path d="M14 300 L386 300 L366 284 L34 284 Z" fill="url(#rovere)"/>
          <g clip-path="url(#piano)">
            <ellipse cx="270" cy="292" rx="0" ry="0" fill="url(#pozza)" class="pozza" data-pozza/>
            <g mask="url(#m-pozza)" class="venature" data-venature>
              <path d="M40 287c60 -1.5 120 1.5 180 0s110 -1.2 150 0.4"/>
              <path d="M30 291c70 1.2 130 -1.6 200 -0.4s100 1.4 150 0"/>
              <path d="M24 295c80 -1.2 150 1.6 210 0.2s90 -1 140 0.4"/>
              <path d="M20 298.5c90 0.8 160 -1 230 0s80 -0.6 120 0"/>
            </g>
          </g>
          <rect x="14" y="300" width="372" height="13" rx="1.5" fill="url(#bordo-rovere)"/>
          <rect x="14" y="300" width="372" height="1" fill="url(#filo-luce)" class="filo" data-filo/>
          <rect x="14" y="313" width="372" height="10" class="ombra-piano"/>

          <!-- the lamp -->
          <ellipse cx="270" cy="296" rx="44" ry="5" class="contatto" data-contatto/>
          <g class="lampada" data-lampada>
            <path d="M238 291.5 a32 4.5 0 0 0 64 0 v-4.5 a32 4.5 0 0 0 -64 0 z" fill="url(#ottone)"/>
            <ellipse cx="270" cy="287" rx="32" ry="4.5" class="base-cima"/>
            <path d="M260 230 Q270 236 280 230" class="cavo-ombra"/>
            <rect x="268.4" y="172" width="3.2" height="116" rx="1.2" fill="url(#ottone)"/>
            <rect x="265.5" y="236" width="9" height="7" rx="2" fill="url(#ottone)" class="collare" data-collare/>
            <g data-testa>
              <path d="M206 177 C206 116, 334 116, 334 177 Z" fill="url(#opale)" class="paralume" data-paralume/>
              <path d="M206 177 C206 116, 334 116, 334 177 Z" fill="url(#acceso)" class="paralume-luce" data-paralume-luce/>
              <path d="M216 160 C220 138, 242 126, 262 124" class="riflesso"/>
              <ellipse cx="270" cy="177" rx="64" ry="4.6" class="labbro"/>
              <ellipse cx="270" cy="178.4" rx="22" ry="2.4" class="lampadina" data-lampadina/>
              <rect x="264" y="114" width="12" height="7" rx="2" fill="url(#ottone)"/>
            </g>
          </g>
        </svg>
      </figure>

      <div class="info">
        <p class="tipo">Table lamp <span class="tipo__marca">Tolvo</span></p>
        <h1 class="nome" data-nome>Moth</h1>
        <p class="fatto">Opal glass, brushed brass, oiled oak.</p>

        <ul class="righe">
          <li class="riga" data-riga="0" tabindex="0">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3 4h14M4 4v6.5h12V4M8 10.5V15M12 10.5V15" /><path d="M6.5 17h7" /></svg>
            <span class="riga__testo">
              <b>Senses the dusk</b>
              <span>Lower the blind, it wakes on its own.</span>
            </span>
          </li>
          <li class="riga" data-riga="1" tabindex="0">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3.5 11.5C3.5 6 16.5 6 16.5 11.5Z"/><path d="M10 13.5v3M6 15l-1.5 1.8M14 15l1.5 1.8"/></svg>
            <span class="riga__testo">
              <b>Hand blown opal</b>
              <span>One soft pool, no glare on the page.</span>
            </span>
          </li>
          <li class="riga" data-riga="2" tabindex="0">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M8.5 12.2V4.5a1.5 1.5 0 0 1 3 0v7.7a3.4 3.4 0 1 1-3 0Z"/><path d="M10 8.5v5"/></svg>
            <span class="riga__testo">
              <b>Warm dim, <em data-kelvin>2700</em> K</b>
              <span>Warms like a candle as it dims.</span>
            </span>
          </li>
        </ul>

        <div class="compra" data-compra>
          <span class="prezzo">$240</span>
          <button class="pillola" type="button" data-pillola>
            <span class="pillola__fondo" aria-hidden="true"></span>
            <span class="pillola__testo" data-pillola-testo>Add to bag</span>
            <svg class="pillola__spunta" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.4 6.6 11.3 12.5 4.9" data-spunta/></svg>
          </button>
        </div>
      </div>
    </div>
  </section>
  <footer class="fine">Tolvo is a made-up studio. Moth is not for sale.</footer>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.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.

30 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 “Desk lamp scroll” 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 warm white background, on the left the scene drawn in SVG: a window with a light frame and a sky from blue to peach, a thin oak desk and the Moth lamp, brushed brass base and stem with its collar, an opal glass dome with a highlight on top. On the right the Tolvo brand, the name Moth large and light, the materials on one line. Scrolling, the blind unrolls with its finely striped fabric and a hem casting a shadow, the cord with its pull follows and swings on a spring when the blind stops, the sky behind turns to evening, the daylight shadow of the lamp fades off the wall and the page background dims slightly. The first row comes in, Senses the dusk, its hairline drawing. Then the lamp flickers on: the dome fills with light from below, the bulb shows under the rim, a soft cone falls, a warm glow grows on the wall and the pool of light opens on the desk with a small overshoot, showing the oak grain and lighting the edge of the desk; the name Moth gains weight with the light. Second row, Hand blown opal. Last the light warms from 2700 to 2200 K and the number in the third row rolls down with it; the price and the black Add to bag pill arrive. With the mouse on the scene the dome leans towards the pointer on an elastic spring and the pool follows it; a click on the dome dims it by half and brings it back; over a row the icon turns amber and tilts, the text moves 3 pixels and widens; the pill swells and on click says Added with a tick that draws itself.

How it works

One sticky stage, one timeline

The section is 340vh tall with a sticky stage 100lvh tall inside (100vh at most). A GSAP timeline of length 1 moves an object of numbers from 0 to 1 (blind, light, pool, warmth, the three rows, the price) and is tied to the scroll with ScrollTrigger and a 0.7 scrub; on every update a single function writes SVG attributes and styles. Lenis smooths the scroll.

The blind and the spring cord

The fabric is a rectangle with a striped pattern, clipped by the glass with a clipPath, that grows from the top; the hem and its shadow follow it. The cord turns around its hook with a hand-written spring in the GSAP ticker: the push is the speed of the blind, so it swings as the blind starts and settles as it stops.

Switching on with a flicker

The light does not rise straight: four very short steps (0.55, 0.12, 0.7, 0.3) and then the climb to 1 on power2.out, all inside the timeline, so the flicker follows the scroll backwards too. The pool on the desk is an ellipse with a radial gradient in screen blend that opens on back.out(1.5); a mask of the same shape shows the oak grain only where the light reaches.

The colour of the light in kelvin

The colour comes from a small scale (1800 K candle, 2200, 2700, 3500, 4500, 6500 K daylight) interpolated with gsap.utils.interpolate and written to the --luce variable: the SVG gradient stops use it (through style, because the stop-color attribute does not read variables) and so does the CSS glow on the wall with color-mix. The number in the third row is the same kelvin rounded to 10.

The leaning dome

With the mouse, gsap.quickTo takes the rotation of the lamp head (svgOrigin where it meets the stem) towards the pointer on elastic.out, and a second quickTo moves the pool by the tangent of the angle times the height of the lamp, so the light on the desk follows the dome. The glow on the wall is put back on the dome on every resize by measuring its box.

Values to change

NameFileDefaultWhat it changes
RIDEscript.js1How much scroll the whole page takes: 2 is twice as long.
SCRUBscript.js0.7Seconds the lamp lags behind the scroll.
POOL_WIDTHscript.js150Half the width of the pool of light on the desk, in drawing units (the desk is 372).
WARM_FROMscript.js2700Colour temperature when the lamp comes on, in kelvin.
WARM_TOscript.js2200Colour temperature at the end of the scroll, in kelvin.
FLICKERscript.jstrueThe lamp flickers once as it comes on.
LEANscript.js7Degrees the dome leans towards the pointer.
DIM_TAPscript.js0.5How bright the lamp stays when you tap the dome (1 does nothing).

Try them in the Playground

When to use it

For the page of a physical product that changes state: a lamp, a diffuser, a wake-up light, a smart home product. When the scroll should tell what the product does one step at a time, and every written feature should arrive together with the moment you see it happen.

On phones

The same animation with adapted sizes: the scene on top, measured on the height too (46% of the screen at most), the rows below; in short boxes only the titles of the rows stay. No leaning of the dome on hover (there is no mouse), but a tap on the dome dims it and brings it back.

With reduced motion

No scroll animation: the page fades in with the blind already down, the lamp on at 2200 K, the three rows and the price in place.

Pitfalls

  • The stop-color attribute of an SVG gradient does not read CSS variables: written as stop-color="var(--luce)" the gradient turns black. It goes in the stop's style.
  • A radial glow drawn inside the SVG is cut by the edge of the drawing with a hard line: here the glow is a div outside the SVG, in the stage, put back on the dome on every resize.
  • A flicker made with a timer does not go back with the scroll: written as steps inside the scrubbed timeline, it plays the same going up and down.
  • The cord needs the speed of the blind, not its position: the ticker measures the difference between one frame and the next, otherwise it stays bent when the scroll stops.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.3 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

Tested on 10 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 animations