Skip to content
animorio
IT
Back to the library

Festival of lights card

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

The festival of lights card of a made-up tea and spice shop, Kesar & Clay, on a warm black page. Five terracotta oil lamps with brass rims, drawn in SVG, light up one after another: a spark jumps on the wick, the flame is born a little too tall and settles, then flickers on its own and lights the oil, a halo above and a pool of light on the ledge, and together they warm the whole card. Each lamp opens one letter of the gift code; with all five lit the code catches a brass gleam and the Copy button wakes up. The pointer blows on the flames, which bend and spring back up.

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>
<!--
  "Festival of lights card" 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 festival of lights card with the oil lamps that light up one after another</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the festival of lights card of a made-up tea and spice shop, Kesar & Clay. Five oil lamps in a row light up one
         after another; each flame is born, flickers on its own soft law and throws warm light on the card. The pointer
         blows on the flames, which bend away and recover. When all five are lit the gift code is complete. -->
    <section class="card" data-card aria-label="Kesar and Clay, festival of lights">
      <span class="card__warm" data-warm aria-hidden="true"></span>
      <span class="card__grain" aria-hidden="true"></span>

      <header class="card__head">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M10 2.5c2.6 3.2 3.9 5.6 3.9 7.6a3.9 3.9 0 0 1-7.8 0c0-2 1.3-4.4 3.9-7.6z" />
            <path d="M3.5 14.5c1.8 2 4 3 6.5 3s4.7-1 6.5-3" />
          </svg>
          <span class="brand__name">Kesar &amp; Clay</span>
        </span>
        <span class="count" aria-live="polite"><span class="count__num" data-count>0</span> of 5 lit</span>
      </header>

      <div class="card__text">
        <p class="eyebrow">Festival of lights</p>
        <h1 class="title">Light all five, <em>open your gift</em></h1>
      </div>

      <div class="row" data-row aria-label="Five oil lamps: tap one to light it"></div>

      <div class="gift" data-gift>
        <div class="gift__left">
          <span class="gift__label">Your gift code</span>
          <span class="code" data-code aria-label="Gift code, hidden until all lamps are lit">
            <span class="code__slot" data-slot><span class="code__ch">S</span></span>
            <span class="code__slot" data-slot><span class="code__ch">H</span></span>
            <span class="code__slot" data-slot><span class="code__ch">U</span></span>
            <span class="code__slot" data-slot><span class="code__ch">B</span></span>
            <span class="code__slot" data-slot><span class="code__ch">H</span></span>
            <span class="code__sheen" data-sheen aria-hidden="true"></span>
          </span>
        </div>
        <div class="gift__right">
          <span class="gift__note" data-note>20% off <span class="gift__more">teas and spices, </span>until Sunday</span>
          <button class="copy" type="button" data-copy disabled>
            <span class="copy__face" data-copy-face>
              <span class="copy__word" data-copy-word>Copy code</span>
              <svg class="copy__check" viewBox="0 0 16 16" aria-hidden="true"><path data-check d="M3.5 8.4l2.9 2.8 6.1-6.4" /></svg>
            </span>
          </button>
        </div>
      </div>
    </section>

    <svg class="defs" aria-hidden="true" width="0" height="0">
      <defs>
        <linearGradient id="clay" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stop-color="#c3653a" />
          <stop offset="0.55" stop-color="#93401f" />
          <stop offset="1" stop-color="#4f1f0e" />
        </linearGradient>
        <linearGradient id="brass" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0" stop-color="#8a5a22" />
          <stop offset="0.45" stop-color="#f1cf86" />
          <stop offset="1" stop-color="#9c6a2c" />
        </linearGradient>
        <radialGradient id="oil" cx="0.6" cy="0.4" r="0.7">
          <stop offset="0" stop-color="#6b3d12" />
          <stop offset="1" stop-color="#2a1406" />
        </radialGradient>
        <radialGradient id="oilLit" cx="0.7" cy="0.3" r="0.8">
          <stop offset="0" stop-color="#ffd27a" />
          <stop offset="0.5" stop-color="#b8661c" />
          <stop offset="1" stop-color="#3c1b07" />
        </radialGradient>
        <linearGradient id="flame" x1="0" y1="1" x2="0" y2="0">
          <stop offset="0" stop-color="#ff7a1a" />
          <stop offset="0.35" stop-color="#ffb347" />
          <stop offset="0.8" stop-color="#ffe7a8" />
          <stop offset="1" stop-color="#fff6dc" />
        </linearGradient>
        <linearGradient id="core" x1="0" y1="1" x2="0" y2="0">
          <stop offset="0" stop-color="#5b8cff" stop-opacity="0.85" />
          <stop offset="0.35" stop-color="#fff6e0" />
          <stop offset="1" stop-color="#ffffff" />
        </linearGradient>
        <radialGradient id="halo" cx="0.5" cy="0.5" r="0.5">
          <stop offset="0" stop-color="#ffbe6b" stop-opacity="0.75" />
          <stop offset="0.35" stop-color="#ff9a3d" stop-opacity="0.28" />
          <stop offset="1" stop-color="#ff8a2a" stop-opacity="0" />
        </radialGradient>
      </defs>
    </svg>

    <svg class="pointer" data-pointer viewBox="0 0 20 20" aria-hidden="true">
      <path d="M4.5 2.8 15.6 11l-5.2 1.1-2.6 4.9z" />
    </svg>
    <p class="sr" data-live aria-live="polite"></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.

31 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 “Festival of lights card” 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 near black page sits a dark card with soft corners, a one pixel edge catching light at the top and a wide shadow. At the top the Kesar & Clay mark (a flame drop over a bowl, in brass lines) and the pill ‘0 of 5 lit’; below, the eyebrow ‘Festival of lights’ and the Fraunces headline, ‘Light all five, open your gift’. In the middle, on a thin ledge, five terracotta oil lamps with brass rims and an incised line on the side. The drawn hand touches one: a spark jumps on the wick, the flame is born taller than it should and settles on a spring, the oil glows amber, the clay side catches a reflection, a halo opens above and a pool of light on the ledge. Each flame flickers on three slow waves of its own, never in step with the others. The more lamps are lit, the warmer the card and the page. Each lamp opens one letter of the gift code, SHUBH, rising out of a blur in its slot; the pill counts. With all five lit a blade of brass crosses the code, ‘20% off teas and spices, until Sunday’ appears and the Copy code button lights up with a bounce; clicked, it squashes and turns into Copied with the tick drawing itself. The pointer blows on the flames: they bend away from it, more when it is near and fast, and come back up swaying. Left alone, the lamps go out one by one with a thread of smoke and a dying ember, and the evening starts again.

How it works

The lamps, drawn once

The five lamps are five buttons, each with an SVG built by the script: the terracotta bowl and spout in one path with a gradient, the brass rim in a stroke with a horizontal gradient, the oil in two ellipses (unlit and lit, swapping with opacity), the wick, the halo and the pool of light with a radial gradient in screen blending. The gradients live once in a hidden SVG and everything points to them.

The flame is a path redrawn

Every frame the flame is rewritten: a drop with a round base, h tall, w wide and with its tip pushed sideways by the lean. h and w come from the flame’s life, its growth (born at 0.15 and reaching 1 with back.out, so it overshoots and settles) and the flicker: three slow sines with a different phase and speed for each lamp. The white and blue core at the base is the same drop, smaller.

The pointer’s breath

Each flame’s lean goes to a target on a spring (stiffness 120, damping 11): the target is a light sway plus the breath, which depends on how close the pointer is to the flame (within 170 pixels, with the square of the closeness) and how fast it runs sideways. So the flame bends away, shortens a little and comes back up swaying. The drawn hand blows too as it passes.

The light adds up

Each lamp’s light (life times flicker) drives the halo, the pool, the oil and the reflection on the side; the sum of the five goes into the CSS variable --lit, which warms the page background, a veil inside the card and its orange shadow.

The code and the button

Each lit lamp opens its letter, which rises out of a blur with back.out, and the pill rolls to its new number. With all five lit a blade of light crosses the code, the note appears and the button goes from asleep to full with elastic.out; clicked, it copies SHUBH, squashes and writes Copied with the tick drawing itself.

Values to change

NameFileDefaultWhat it changes
LIGHT_GAPscript.js0.9Left alone, seconds between one lamp and the next.
FLAMEscript.js1How tall the flames are.
FLICKERscript.js1How much the flames tremble: 0 for still flames.
BLOWscript.js1How strongly the pointer bends the flames.
GLOWscript.js1How much warm light the flames throw on the card.
HOLDscript.js2.4Seconds with all five lit before they go out.
LOOPscript.jstrueLeft alone, lights them and puts them out again and again.

Try them in the Playground

When to use it

For a seasonal Diwali or festival of lights promotion in an online shop, an app or a newsletter: a card asking for a small gesture (lighting the lamps) and rewarding it with a gift code. It also suits an evening event, a restaurant or a hotel celebrating.

On phones

The same animation with adapted sizes: the card takes almost the whole width, headline, lamps and code scale with the screen’s height too. You tap a lamp with your finger to light it; dragging your finger over the flames blows on them.

With reduced motion

No flicker, no bending flames, no spark and no drawn hand: the lamps light up and go out with a fade, the code letters fade in and the button wakes up without a bounce.

Pitfalls

  • A CSS animation on the flame can’t bend it from the bottom: scaling or rotating it moves the base too. The path has to be rewritten with the base still on the wick and only the tip moving.
  • Three sines at the same speed for every lamp make them flicker in step, like a row of fake lights: each lamp needs its own phase and speed.
  • The screen-blended halo needs a dark background: on a light one it disappears, and the light has to be made with a coloured shadow.
  • A lamp’s centre is measured from the SVG with preserveAspectRatio xMidYMax: it must be recomputed on resize and when the fonts arrive, which change the card’s height.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0.

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

Testing

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