Skip to content
animorio
IT
Back to the library

The colour chapters

Scroll, SVGGSAP, CSS onlyMediumCompressed weight: Demo 7.5 KBGSAP + ScrollTrigger 45 KBFreeDownload the zip

Scroll inside the preview

A page in chapters with a pinned panel that changes colour as you scroll and writes each chapter’s mark with a brush, while beside it the moments scroll by, the drawings slightly slower than the text.

Rebuilt from scratch studying champohaircare.com by BAO: 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>
<!--
  "The colour 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="it">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>I capitoli di colore</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/standard.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header class="apertura">
    <h1 class="apertura__titolo">Una giornata all’orto</h1>
    <p class="apertura__testo">Dall’alba alla notte, un colore per ogni ora. Scorri: il pannello cambia colore e ogni capitolo si scrive col pennello.</p>
  </header>

  <!-- al telefono il pannello diventa una barra in alto col colore del capitolo -->
  <div class="barra" data-barra aria-hidden="true">
    <svg class="barra__segno" data-barra-segno viewBox="0 0 200 200" focusable="false"></svg>
    <span class="barra__nome" data-barra-nome>Alba</span>
  </div>

  <main class="giornata" data-giornata>
    <div class="giornata__momenti">
        <section class="capitolo capitolo--alba" data-capitolo="alba" aria-label="Alba">
          <h2 class="capitolo__titolo">Alba</h2>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="cesta" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">6:10</span> La cesta delle zucchine, ancora bagnate.</figcaption>
          </figure>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="annaffiatoio" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">6:45</span> Un giro d’acqua alle lattughe.</figcaption>
          </figure>
        </section>
        <section class="capitolo capitolo--mezzogiorno" data-capitolo="mezzogiorno" aria-label="Mezzogiorno">
          <h2 class="capitolo__titolo">Mezzogiorno</h2>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="cappello" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">12:20</span> Il cappello resta appeso al cancello.</figcaption>
          </figure>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="brocca" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">13:00</span> Acqua, limone e un bicchiere solo.</figcaption>
          </figure>
        </section>
        <section class="capitolo capitolo--tramonto" data-capitolo="tramonto" aria-label="Tramonto">
          <h2 class="capitolo__titolo">Tramonto</h2>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="pomodori" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">19:10</span> Il rosso più rosso della giornata.</figcaption>
          </figure>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="carriola" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">19:40</span> La carriola torna vuota al capanno.</figcaption>
          </figure>
        </section>
        <section class="capitolo capitolo--notte" data-capitolo="notte" aria-label="Notte">
          <h2 class="capitolo__titolo">Notte</h2>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="lanterna" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">22:30</span> Una lanterna sul muretto.</figcaption>
          </figure>
          <figure class="momento" data-momento>
            <div class="momento__quadro"><svg class="momento__disegno" data-disegno="cane" viewBox="0 0 200 150" aria-hidden="true" focusable="false"></svg></div>
            <figcaption class="momento__testo" data-testo><span class="momento__ora">23:50</span> Il cane dorme sul portico.</figcaption>
          </figure>
        </section>
    </div>
    <aside class="pannello" data-pannello aria-hidden="true">
      <div class="pannello__dentro">
        <svg class="pannello__segno" data-segno viewBox="0 0 200 200" focusable="false"></svg>
        <div class="pannello__voce" data-voce="alba">
          <p class="pannello__nome">Alba</p>
          <p class="pannello__frase">Si raccoglie prima del caldo.</p>
        </div>
        <div class="pannello__voce" data-voce="mezzogiorno">
          <p class="pannello__nome">Mezzogiorno</p>
          <p class="pannello__frase">L’ombra del fico è l’unica stanza fresca.</p>
        </div>
        <div class="pannello__voce" data-voce="tramonto">
          <p class="pannello__nome">Tramonto</p>
          <p class="pannello__frase">I pomodori prendono l’ultimo sole.</p>
        </div>
        <div class="pannello__voce" data-voce="notte">
          <p class="pannello__nome">Notte</p>
          <p class="pannello__frase">L’orto beve la guazza.</p>
        </div>
      </div>
    </aside>
  </main>

  <footer class="chiusura">
    <p class="chiusura__testo">Domani si ricomincia, un po’ prima del sole.</p>
  </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="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.

59 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 “The colour 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

A day in the kitchen garden in four chapters: dawn, noon, sunset and night. On the right a panel as tall as the screen stays still: at the start of each chapter a mark is written on it with a brush (a rising sun, a full sun, a setting sun, the moon) and below appear the name and a sentence; at the end of the chapter the mark erases itself in the same direction it was written, and the panel’s colour moves to the next: peach, linen, coral, indigo. At night the text turns light. On the left the moments of the day scroll by, drawn: the basket of courgettes, the watering can, the hat, the tomatoes, the lantern, the sleeping dog. Each drawing scrolls slightly slower than its caption, and rises into place the first time it passes.

How it works

A still panel without a pin

The page is a two-column grid and the panel is the right-hand element, with position: sticky, top 0, a height equal to the screen and align-self: start. It stays still while the column of moments scrolls beside it, with no spacer and no recalculation.

Writing and erasing in the same direction

Each mark is a calligraphic outline uncovered by a mask, a wide line with pathLength 1. To write it the stroke-dashoffset goes from 1.02 to 0; to erase it, it does not go back but carries on to −1.02: the visible stroke slides past the end of the line, and the mark disappears from its start, like a trace drying.

One timeline per chapter

Each chapter has its own timeline of length 1, tied to scrolling from when its top passes 70% of the screen to when its bottom does: between 0 and 0.3 it writes the mark, at 0.06 it brings in the text, between 0.8 and 1 it erases both. The colour instead changes in a separate tween, while the chapter’s top goes from 72% to 38% of the screen.

Two speeds

Inside each frame the drawing is enlarged 1.2 times and moves from yPercent 9 to −9 while the moment crosses the screen; the caption below moves about twenty pixels the other way. On phones the panel disappears and in its place a fixed bar slides down with the colour, the small mark and the chapter name, which changes with a small jump.

Values to change

NameFileDefaultWhat it changes
CAPITOLIscript.js4 capitoliFor each chapter: name, panel colour, text colour and mark (a line in 200 × 200 and the brush width).
DISEGNIscript.js8 disegniThe moments’ drawings, in SVG 200 × 150: they can be replaced by photographs in the same frame.
min-height del capitolostyle.css150% dello schermoHow long a chapter lasts: taller, more scrolling for each colour.

Try them in the Playground

When to use it

To tell a day, a process, the seasons or a product’s lines, when each step has its own colour and a mark to remember.

On phones

A single column; the panel gives way to a fixed bar at the top that slides down when the chapters begin and changes colour, mark and name at every chapter.

With reduced motion

The marks are not written and the drawings do not scroll at different speeds: at every chapter the panel changes colour, mark and text with a two-tenths fade.

Pitfalls

  • A sticky element inside a grid needs align-self: start, or the cell stretches to the row’s height and the element has no room to stay still.
  • When several ScrollTriggers animate the same colour, use fromTo with written start and end colours and immediateRender: false: that way the order in which they update does not matter.
  • To erase a stroke in the same direction it was written, take the stroke-dashoffset into negative values, do not bring it back to 1; and the dasharray must be «1 3», not «1 1», or at −1.02 and 1.02 a sliver of the next dash shows.
  • The drawing moving inside its frame must be larger than the frame, or its edges show.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 September 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: Done

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