Skip to content
animorio
IT
Back to the library

Randomly lit chapters

Text, ScrollGSAP, CSS onlyMediumCompressed weight: Demo 9.0 KBGSAP + ScrollTrigger + SplitText + CustomEase + ScrambleText 56 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A chapter page for a made-up real estate developer, Veyra: the stage stays still and six chapters go by as you scroll. The capital title lights up letter by letter in random order, the text rises line by line and the bevelled glass button enters with two trails of light running round its edge. On the left the index of the chapters, written in scrambling letters, with the thin bar of the open one flickering and staying lit.

Rebuilt from scratch studying hubtown.co.in by Unseen Studio: the idea is theirs; code, copy and images are ours. Read how it’s made

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>
<!--
  "Randomly lit chapters" 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>Veyra, builders since 1994</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/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- a made-up real estate developer, Veyra. The stage stays still while you scroll through six chapters: each title
       lights up letter by letter in random order, the text rises line by line and the bevelled button enters with two
       trails of light running round its edge. On the left the index of the chapters, rewritten letter by letter -->
  <main class="corsa" data-corsa>
    <div class="palco" data-palco>
      <svg class="orizzonte" data-orizzonte aria-hidden="true"></svg>

      <header class="testa">
        <a class="marchio" href="#" aria-label="Veyra">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M2 3h4l4 10 4-10h4L11.6 18H8.4z"/></svg>
          <span>Veyra</span>
        </a>
        <nav class="testa__voci" aria-label="Main">
          <a href="#">Projects</a><a href="#">Studio</a><a href="#">Journal</a><a href="#">Contact</a>
        </nav>
      </header>

      <nav class="indice" data-indice aria-label="Chapters"></nav>

      <div class="contenuto" data-contenuto aria-live="polite">
        <p class="etichetta" data-etichetta></p>
        <h1 class="titolo" data-titolo></h1>
        <p class="testo" data-testo></p>
        <div class="azione" data-azione>
          <a class="smussato" href="#" data-smussato>
            <svg class="smussato__bordo" data-bordo aria-hidden="true">
              <path class="smussato__base" data-base/>
              <path class="smussato__alone" data-alone/>
              <path class="smussato__scia" data-scia/>
            </svg>
            <span class="smussato__lampo" data-lampo></span>
            <svg class="smussato__icona" viewBox="0 0 12 12" aria-hidden="true">
              <rect x="1" y="1" width="2" height="10"/><rect x="5" y="3" width="2" height="8"/><rect x="9" y="5" width="2" height="6"/>
            </svg>
            <span class="smussato__testo" data-cta></span>
          </a>
        </div>
      </div>

      <footer class="piede">
        <span class="piede__scorri">
          <svg viewBox="0 0 10 14" aria-hidden="true"><path d="M5 1v11M1.5 8.5 5 12l3.5-3.5"/></svg>
          Scroll to explore
        </span>
        <span class="piede__ora">Now reading <b data-ora></b></span>
      </footer>
    </div>
  </main>

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

18 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 “Randomly lit chapters” 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 navy background, behind everything, a floor of very thin lines runs to a horizon with a blue glow; the rows come slowly closer on their own. The stage stays still and six chapters of the made-up developer Veyra go by as you scroll (Ground, Light, Craft, Measure, Place, Time). At each chapter the bold capital title lights up letter by letter in random order, in just over a second; the text rises line by line and the button comes up from below, while two trails of light leave opposite points of its bevelled edge and run half way round each, stretching and shrinking. On the way out everything fades in a second while the new chapter lights up; the horizon moves a little, opening or closing. On the left the index: the names come in from the right written in scrambling letters, the bar of the open chapter flickers eight times and stays lit, the others rest at 30%. Hovering a name raises it to 70%, rewrites it and blinks its bar; a click takes you to the chapter. Hovering the button runs the two trails again, its glass flashes faintly and the label scrambles. Bottom right, the name of the chapter you are reading rewrites itself at every change.

How it works

One stage and six blocks

The run is six times CHAPTER_SCROLL plus one screen tall, and the stage inside is sticky. A single ScrollTrigger splits the progress into six parts: when the part changes, the old block leaves and the new one enters, so they cross like on the original, where each chapter has its own ScrollTrigger with onEnter and onLeave.

Letters at random

SplitText splits the title into letters and the text into lines. The letters go from autoAlpha 0 to 1 in 0.4 seconds with stagger amount STAGGER and from "random"; the lines rise by 2.5rem with stagger 0.2; the easing is the original’s curve, CustomEase "M0,0 C0.2,0 0.1,1 1,1".

The flickering bar

The bar of the open chapter runs an autoAlpha tween an eighth of a second long, as a yoyo, repeated until it has blinked FLICKERS times, and then stays lit. The index names are written with ScrambleTextPlugin in capitals (chars "upperCase"), 0.05 seconds apart.

The bevelled edge and the two trails

The button’s edge is a path computed from its size, with two corners cut by BEVEL pixels and two slightly rounded, starting from the top centre. On top sits the same path with a single dash repeated every half perimeter: two trails, always opposite. In one second, with power2.inOut, the strokeDashoffset moves half a perimeter and the dash length is TRAIL_LENGTH times sin(π·p).

The horizon

An SVG with twenty-six rays from the vanishing point and sixteen horizontal rows placed at depth z to the power of 2.2, so they bunch up towards the horizon. Every frame the rows move a little; at each chapter GSAP takes the vanishing point, the horizon height, the spread of the rays and the glow to their new values.

Values to change

NameFileDefaultWhat it changes
STAGGERscript.js1.1How many seconds the letters of a title take to all light up, in random order.
FLICKERSscript.js8How many times the bar of the open chapter flickers before it stays lit.
TRAIL_LENGTHscript.js50How long the two trails of light on the button get at most (in pixels).
BEVELscript.js20How big the cut corners of the button are (in pixels).
LERPscript.js0.08How soft the scroll is: lower is softer.
CHAPTER_SCROLLscript.js85How much you scroll for each chapter, in screen heights (100 = one screen).

Try them in the Playground

When to use it

For the home page of a real estate developer, an architecture studio or anyone who tells their work in a few principles: each chapter is one big sentence, one line and one action, and the side index always tells you where you are.

On phones

The same animation with adapted sizes: as on the original the side index disappears and the chapter name becomes the label above the title; the chapter sits bottom left and the title is sized on the height too, so everything fits on screen. The button runs its trails again on tap.

With reduced motion

No smooth scroll, no random letters and no flicker: each chapter fades in and out whole, the index names are already written and the horizon stays still.

Pitfalls

  • Each chapter has its own block: with a single block to rewrite, the old chapter would have to finish fading before the new one lights up, and the crossing of the original would be lost.
  • SplitText must be redone on resize (the lines change), and the open block must be set fully lit right after, or it stays dark until the chapter changes.
  • The trail dash has a round cap: at zero length it would draw two dots, so below half a pixel the trail is hidden.
  • The button glass is cut with a clip-path computed from the same sizes as the edge: with a border-radius the bevelled corners would not match.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, SplitText 3.15.0, ScrambleTextPlugin 3.15.0, CustomEase 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.0 KB; the libraries: GSAP + ScrollTrigger + SplitText + CustomEase + ScrambleText 56 KB, Lenis 5.3 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