Skip to content
animorio
IT
Back to the library

Colour flood transition

Transitions, SVGGSAP, CSS onlyMediumCompressed weight: Demo 7.7 KBGSAP 28 KBFreeDownload the zip

The page of one colour by Fernleigh Paints, a made-up paint maker: pick a swatch in the row at the bottom and its colour floods the whole page starting from the swatch itself, behind a wet edge drawn in SVG that ripples a little as it runs and settles flat, with a soft shadow along the rim. The type turns dark or light to stay readable the moment the paint passes under it, block by block, and the name, the code, the finish, the note and the price roll to the new colour. The chosen swatch lifts by a pixel. Minimal style.

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>
<!--
  "Colour flood transition" 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>Fernleigh Paints, colour of the week</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 page of one colour of a made-up paint maker, Fernleigh Paints. Pick a swatch at the bottom and its colour
       floods the whole page from the swatch, behind an edge that ripples like wet paint and settles; the type on top
       turns light or dark to stay readable just as the paint reaches it, and the name, the code and the note roll
       to the new colour -->
  <main class="pagina" data-pagina>
    <svg class="piena" data-piena aria-hidden="true" focusable="false">
      <defs>
        <filter id="orlo" x="-20%" y="-20%" width="140%" height="140%">
          <feDropShadow dx="0" dy="6" stdDeviation="14" flood-color="#000" flood-opacity=".16" data-ombra-orlo />
        </filter>
      </defs>
      <path data-macchia filter="url(#orlo)" d="M0 0Z" />
    </svg>

    <header class="testa" data-tinta>
      <p class="marchio">Fernleigh <span>Paints</span></p>
      <nav class="voci" aria-label="Fernleigh">
        <a href="#">Colours</a><a href="#">Finishes</a><a href="#">Stockists</a>
      </nav>
    </header>

    <section class="colore" data-tinta aria-live="polite">
      <p class="sopra" data-rullo="finitura"><span class="riga">Interior emulsion · Matt</span></p>
      <h1 class="nome" data-rullo="nome"><span class="riga">Harbour Fog</span></h1>
      <p class="codice" data-rullo="codice"><span class="riga">FP 0214 · LRV 61</span></p>
      <p class="nota" data-rullo="nota"><span class="riga">A grey with a breath of sea in it. Cool by the window, soft by lamplight.</span></p>
      <button class="pillola" type="button" data-pillola>
        <span class="pillola__fondo" aria-hidden="true"></span>
        <span class="pillola__testo">Order a sample</span>
        <span class="pillola__prezzo" data-rullo="prezzo"><span class="riga">£4.50</span></span>
      </button>
    </section>

    <div class="campioni" data-tinta role="radiogroup" aria-label="Colours">
      <button class="campione" type="button" role="radio" data-campione data-colore="#c9d0cc" data-nome="Harbour Fog" data-codice="FP 0214 · LRV 61" data-finitura="Interior emulsion · Matt" data-nota="A grey with a breath of sea in it. Cool by the window, soft by lamplight." data-prezzo="£4.50"><span class="campione__chip"></span><span class="campione__nome">Harbour Fog</span></button>
      <button class="campione" type="button" role="radio" data-campione data-colore="#b5654a" data-nome="Clay Pot" data-codice="FP 0388 · LRV 18" data-finitura="Interior emulsion · Matt" data-nota="Terracotta left out in the sun. Warm on a north wall, deep in a hallway." data-prezzo="£4.50"><span class="campione__chip"></span><span class="campione__nome">Clay Pot</span></button>
      <button class="campione" type="button" role="radio" data-campione data-colore="#8f9c84" data-nome="Sage Hall" data-codice="FP 0451 · LRV 34" data-finitura="Eggshell · Wood and walls" data-nota="An old green, a little dusty. It sits quietly next to oak and linen." data-prezzo="£4.50"><span class="campione__chip"></span><span class="campione__nome">Sage Hall</span></button>
      <button class="campione" type="button" role="radio" data-campione data-colore="#22303f" data-nome="Ink Well" data-codice="FP 0907 · LRV 4" data-finitura="Interior emulsion · Matt" data-nota="Blue so dark it reads as night. Brass and white woodwork love it." data-prezzo="£4.50"><span class="campione__chip"></span><span class="campione__nome">Ink Well</span></button>
      <button class="campione" type="button" role="radio" data-campione data-colore="#d9a441" data-nome="Mustard Lane" data-codice="FP 0563 · LRV 47" data-finitura="Exterior masonry · Smooth" data-nota="A yellow with some earth in it. Bright on a door, kind in a kitchen." data-prezzo="£4.95"><span class="campione__chip"></span><span class="campione__nome">Mustard Lane</span></button>
      <button class="campione" type="button" role="radio" data-campione data-colore="#e8c7b8" data-nome="Plaster Pink" data-codice="FP 0122 · LRV 66" data-finitura="Interior emulsion · Matt" data-nota="Bare plaster, just dried. Pink in the morning, almost white by noon." data-prezzo="£4.50"><span class="campione__chip"></span><span class="campione__nome">Plaster Pink</span></button>
    </div>
  </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.

27 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Colour flood transition” 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

The whole page is in Fernleigh Paints’ Harbour Fog, a grey with a little sea in it. At the top the brand and three links; in the middle, in small caps, the finish («Interior emulsion · Matt»), the colour’s name very large, the code with the light reflectance, two lines describing the colour and the «Order a sample £4.50» pill in the colour of the ink. At the bottom six swatches with their names: Harbour Fog, Clay Pot, Sage Hall, Ink Well, Mustard Lane, Plaster Pink. Clicking a swatch, the swatch dips a breath and then lifts by a pixel with a soft shadow and a hairline drawing underneath; from its centre its colour spreads over the whole page, with a rim that isn’t a smooth circle but ripples a little, like wet paint finding its way, and lies flat once the page is covered, with a soft shadow along the rim. When the paint reaches under the swatches, then under the name and finally under the brand, that type switches to a dark ink on light colours or a light ink on dark colours. Meanwhile the finish, the name, the code, the note and the price leave upwards and the new ones rise from below, one after the other, and the pill’s ground bounces. Left alone, the page moves from one colour to the next about every three seconds until it is touched; the arrow keys change swatch.

How it works

The paint is an SVG path

Above the page’s ground and below the type there’s an SVG as large as the page with a single path, filled with the new colour. Every frame the path is redrawn around the centre of the swatch: 96 points on a circle, each at a radius that changes a little with the angle (the sum of three sines), joined with quadratic curves through the midpoints, so the rim is soft.

The rim that settles

The radius goes from zero to the farthest corner of the page in FLOOD seconds with power3.inOut. The ripple’s amplitude follows a sine of the progress: it starts small, is strongest halfway and goes back to zero at the end, so the paint lies flat. The phases drift with the progress: the rim seems to move, not just grow.

The shadow on the rim

The path has a soft feDropShadow (SHADOW opacity) moved six pixels down: along the wet rim the new paint casts a little shadow on the old one, like a coat settling on top, and the shadow is gone once the page is covered.

The right ink at the right time

For each colour the relative luminance picks the ink: dark above 0.28, light below. Each block of type (brand, colour, swatches) has its own --ink and --carta variables: the code measures the distance of its centre from the swatch and, inverting the radius curve, the moment the paint gets there; at that moment GSAP takes the variables to their new values in 0.32 seconds.

The rolling lines

Each line sits in a window with hidden overflow: the new line is added below the old one, the old one rises with power3.in and the new one arrives with expo.out, in ROLL seconds, one line after the other.

The swatch and the walk on its own

The chosen swatch squeezes to 0.96 for 0.09 seconds and then lifts by LIFT pixels with back.out and a soft shadow; the line underneath draws from the left. With nobody touching, a delayedCall picks the next colour every IDLE seconds; the first real touch stops it, and after 9 seconds of quiet it walks on.

Values to change

NameFileDefaultWhat it changes
FLOODscript.js1.25Seconds the paint takes to cover the page.
WOBBLEscript.js0.05How much the wet rim ripples (share of the radius).
LOBESscript.js5How many soft waves run along the rim.
ROLLscript.js0.7Seconds the name and details take to roll to the new colour.
LIFTscript.js1Pixels the chosen swatch lifts.
SHADOWscript.js0.16Opacity of the soft shadow along the rim.
IDLEscript.js2.9Seconds between colours when nobody touches (0 = never on its own).

Try them in the Playground

When to use it

For the page of a colour or a collection: a paint shop or brand, a fabric, tile or wallpaper store, a configurator where you pick a product’s colour. And anywhere a theme or page change should start from the point of the click.

On phones

The same animations. The name is min(10.5vw, 15vh) large, the menu links hide, the swatches stay in a single narrower row, and below 460 pixels of height the note hides, so everything fits in the box.

With reduced motion

No ripple and no rolling: the new colour fades in over the whole page in 0.45 seconds, the type changes ink and text with a fade, the swatch is already lifted, and the page doesn’t change colour by itself.

Pitfalls

  • The CSS variables --ink and --carta live on each block, not on the page: so each one changes ink when the paint actually reaches it, not all at once.
  • The final radius is the distance from the swatch to the farthest corner plus room for the ripple, otherwise a corner stays bare for a moment at the end.
  • A click halfway through first takes the old run to its end (progress(1)): the page always has a solid colour underneath, never two paths at once.
  • The autopilot’s click isn’t a real event (isTrusted is false): it doesn’t stop the walk on its own.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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