Skip to content
animorio
IT
Back to the library

Candlelit headline

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

A Halloween headline in the dark, standing on a shelf, in minimal style: a candle follows the pointer in front of the letters, the nearby ones warm to orange and gain weight, and every letter throws a long shadow up the wall that trembles with the flame. A click blows it out, and it lights again by itself.

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>
<!--
  "Candlelit headline" 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>By candlelight</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>
  <!-- a headline in the dark, read by candlelight. The candle stands on the shelf in front of the letters and follows the
       pointer along it; the letters near the flame warm up and take weight, and every letter throws a long shadow up the
       wall, away from the flame, trembling with it. Click (or tap) to blow the candle out; it lights again by itself. -->
  <main class="stanza" data-stanza>
    <div class="muro" data-muro aria-hidden="true"></div>
    <p class="occhiello" data-occhiello>Hollow Lane Reading Room</p>

    <div class="scena" data-scena>
      <div class="ombre" data-ombre aria-hidden="true"></div>
      <h1 class="titolo" data-titolo>Something wicked this way comes</h1>
      <div class="mensola" data-mensola aria-hidden="true"></div>

      <div class="candela" data-candela aria-hidden="true">
        <div class="candela__luce" data-alone></div>
        <div class="candela__corpo" data-corpo>
          <canvas class="candela__fuoco" data-fuoco></canvas>
          <span class="candela__stoppino" data-stoppino></span>
          <div class="candela__cera">
            <span class="candela__pozza"></span>
            <span class="candela__colata" data-colata><i></i></span>
            <span class="candela__colata candela__colata--due" data-colata><i></i></span>
          </div>
          <span class="candela__ombra"></span>
        </div>
        <span class="candela__piattino"><i></i></span>
      </div>
    </div>

    <p class="sotto" data-sotto>Halloween night. Ghost stories by candlelight, 9 pm.</p>
    <p class="aiuto" data-aiuto>Move the candle. Click to blow it out.</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.

19 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 “Candlelit headline” 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 stands the headline “Something wicked this way comes”, large, in condensed Mona Sans, on a thin shelf, with the name of a made-up reading room above and a line about Halloween night below. In the dark the letters can barely be seen. In front of them, on the shelf, stands a candle on its saucer, the wax slowly dripping and the flame breathing. The candle follows the pointer along the shelf on a spring, and the flame leans against the movement. The letters near the flame warm from pumpkin orange to the warm white of the wax and gain weight; every letter throws a long shadow up the wall, starting at its foot and rising away from the flame, longer and sharper when the flame is close, softer when it is far, trembling with the flicker of the light. The wall lights up only around the candle, with the grain of the plaster. A click (or a tap) blows the candle out: the flame leans and disappears, a thread of smoke rises from the wick and the headline goes back into the dark; shortly after, a spark lights it again, the flame growing past its size and settling. With nobody there, the candle slowly crosses the headline and halfway round it goes out and lights again.

How it works

The headline twice

The script splits the headline into lines, words and letters twice: one copy is the letters, the other, beneath and in the same place, is their shadows. Every letter keeps the width measured in the dark, so when it gains weight it widens in place and the headline does not move; the shadow gets the same width.

The breathing flame

The candle chases the pointer on a spring (0.09 stiffness, 0.72 damping). The flicker is a sum of three sines that never repeat, plus an occasional jolt: it moves the size of the flame, the reach of the light, the light on the wall and the shadows.

Warmth and weight

For each letter the distance from the flame, with the vertical part weighted 1.25 times, becomes a warmth exp(−(d/R)²) with R of 2.6 em. Warmth mixes the colour from the dark to pumpkin orange and then to warm white, takes the weight from 380 to 700 on the wght axis and lights an orange glow. Letters are rewritten only when they change.

The long shadow

Every shadow starts at the letter’s foot (transform-origin at 50% and 86%) and leans with a skewX of the angle between letter and flame, stretches with scaleY, more when the flame is close, and blurs with distance. The flicker adds a few degrees and a little length: the shadow trembles with the flame.

The breath

On click a GSAP timeline takes the light to zero in 0.42 s, raises a thread of SVG smoke with stroke-dashoffset and after 1.75 s lights it again with elastic.out: the flame grows past its size and settles.

Values to change

NameFileDefaultWhat it changes
TITOLOscript.jsSomething wicked|this way comesThe headline; the vertical bar starts a new line.
RAGGIOscript.js2.6How far the flame warms, in the headline’s em.
LUNGHEZZAscript.js1.6How far the shadows stretch up the wall.
TREMOLIOscript.js1How much the flame flickers, and with it the light and the shadows.
PESOscript.js700The weight of the letters closest to the flame.
GIROscript.js12How many seconds the candle takes to go round on its own.
--zuccastyle.css#ff7a1aThe orange of the flame and the warm letters.

Try them in the Playground

When to use it

For the opening of a Halloween page, a night of stories, an exhibition or a night-time event, or for the headline of a section that should feel read by candlelight.

On phones

The same animation with adapted sizes: the headline and the candle are sized on the height too, the candle is dragged with a finger and a tap blows it out.

With reduced motion

The candle stays still and does not flicker, the shadows are still, no breath or smoke: a click fades the light down and up again.

Pitfalls

  • The variable weight changes the width of the letters: without fixing the width measured in the dark, the headline would move on every frame and the shadows would no longer sit under their letters.
  • Widths are measured again after document.fonts.ready and on every resize, with the letters set back to their dark weight before measuring.
  • Thirty blur filters changing every frame are costly: the shadows are rewritten only when they really change.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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