Skip to content
animorio
IT
Back to the library

Flavour swap scroll

Scroll, TextGSAP, CSS onlyMediumCompressed weight: Demo 9.3 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

The flavour slider of Scorchly, a made-up brand of spicy almonds and peanuts, in the premium style of the product pieces: the stage stays still and, as you scroll, the four flavours take turns. The giant word of the flavour drops out of its mask letter by letter while the new one falls from above, the bag spins away and the new one comes in from the other side, lands one pixel too far with a small sway, the shadow underneath goes out and spreads again, the ground takes the colour of the flavour and the name strips and the round button pop back from nothing.

Rebuilt from scratch studying henrietta.wearetattoodigital.com by Tattoo Digital: 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>
<!--
  "Flavour swap scroll" 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>Scorchly, seriously spicy nuts</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/archivo@5.3.0/wdth.css">
  <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 flavour slider of a made-up spicy snack brand, Scorchly. A sticky stage: as you scroll, the giant word of the
       flavour drops out letter by letter while the next one falls in from above, the bag spins away and the next bag
       spins in from the other side and lands with a small sway, the ground takes the colour of the flavour, the shadow
       goes out and spreads again under the new bag, the lines of the description slide in their masks and the strips
       and the round button pop back from nothing -->
  <svg class="defs" width="0" height="0" aria-hidden="true" focusable="false">
    <defs>
      <linearGradient id="lati" x1="0" x2="1" y1="0" y2="0">
        <stop offset="0" stop-color="#000" stop-opacity=".42"/>
        <stop offset=".07" stop-color="#000" stop-opacity=".12"/>
        <stop offset=".2" stop-color="#fff" stop-opacity=".16"/>
        <stop offset=".32" stop-color="#fff" stop-opacity="0"/>
        <stop offset=".72" stop-color="#000" stop-opacity="0"/>
        <stop offset=".9" stop-color="#000" stop-opacity=".2"/>
        <stop offset="1" stop-color="#000" stop-opacity=".46"/>
      </linearGradient>
      <linearGradient id="alto" x1="0" x2="0" y1="0" y2="1">
        <stop offset="0" stop-color="#fff" stop-opacity=".12"/>
        <stop offset=".18" stop-color="#fff" stop-opacity="0"/>
        <stop offset=".86" stop-color="#000" stop-opacity="0"/>
        <stop offset="1" stop-color="#000" stop-opacity=".22"/>
      </linearGradient>
      <linearGradient id="riflesso" x1="0" x2="0" y1="0" y2="1">
        <stop offset="0" stop-color="#fff" stop-opacity="0"/>
        <stop offset=".3" stop-color="#fff" stop-opacity=".34"/>
        <stop offset=".62" stop-color="#fff" stop-opacity=".16"/>
        <stop offset="1" stop-color="#fff" stop-opacity="0"/>
      </linearGradient>
      <pattern id="crimp" width="2.6" height="20" patternUnits="userSpaceOnUse">
        <rect width=".9" height="20" fill="#000" fill-opacity=".16"/>
        <rect x=".9" width=".5" height="20" fill="#fff" fill-opacity=".1"/>
      </pattern>
      <filter id="morbido" x="-50%" y="-10%" width="200%" height="120%"><feGaussianBlur stdDeviation="2.4"/></filter>
    </defs>
  </svg>

  <section class="corsa" data-corsa>
    <div class="palco" data-palco>
      <div class="luce" aria-hidden="true"></div>
      <div class="parole" data-parole aria-hidden="true"></div>
      <div class="ombra" data-ombra aria-hidden="true"><div class="ombra__in" data-ombra-in></div></div>
      <div class="sacchi" data-sacchi></div>

      <header class="testa" data-testa>
        <p class="marca">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.2 1.2c2.6 2.2 4.3 4.6 4.3 7.4a4.5 4.5 0 0 1-9 0c0-1.7.8-3.1 1.9-4.2.1 1.3.7 2.2 1.6 2.6-.2-2.3.2-4.1 1.2-5.8z"/></svg>
          Scorchly
        </p>
        <nav class="gusti" data-gusti aria-label="Flavours">
          <span class="gusti__pillola" data-pillola aria-hidden="true"></span>
        </nav>
      </header>

      <div class="strisce" data-strisce></div>
      <div class="piede">
        <div class="descrizioni" data-descrizioni></div>
        <div class="bottoni" data-bottoni></div>
      </div>
      <div class="grana" aria-hidden="true"></div>
    </div>
  </section>

  <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/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.

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 “Flavour swap scroll” 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 full red ground, with a soft light in the middle and a light grain, sits the flavour slider of Scorchly: at the top the mark with the little flame and the row of the four flavours (Kimchi, Chicken, Buffalo, Lemon) in a thin pill, where the active one has its light round; on the left two name strips (Fermented, Kimchi), one paper-coloured and one dark; in the middle the giant word KIMCHI in a very narrow grotesque and, in front of it, the stand-up pouch drawn clean: the zigzag seal with its crimp, the tear notch, the shading on the sides, a soft reflection and a thread of light on the edge, the gusset at the bottom and the paper label with the brand, the flavour and the weight. Below, the three-line description and the round View bag button, turned 15 degrees. On opening the word falls from above letter by letter, the bag comes down spinning, lands one pixel low and sways, the shadow spreads, then the strips and the button arrive. Scrolling, at every flavour: strips and button shrink to nothing, the lines slide up and away in their masks, the letters of the word drop out one after the other with a small backswing while those of the new flavour fall from above, the bag leaves diagonally turning 180 degrees and the new one comes in from the other side turning the other way, lands one pixel too far with three smaller and smaller sways; the shadow goes out and, as the bag touches down, spreads past its size and comes back; the ground goes from red to brown, to orange, to yellow, and on yellow the type turns dark; the round in the row slides onto the new flavour. The names in the row take you to their flavour. Scrolling back, everything rewinds.

How it works

One timeline, tied to the scroll

All the changes are one paused GSAP timeline, a change every 3.6 timeline seconds, and ScrollTrigger drives it back and forth with scrub while the stage stays still with position: sticky, 100lvh tall. Lenis smooths the wheel. The waiting flavours start in their starting places: the letters above the mask, the bag hidden, strips and button at scale zero.

The letters in their mask

Each letter of the giant word sits in a span with overflow hidden and line-height 1 (with the word’s tight line-height the glyphs would overflow their box and a sliver would show above the mask). The old letter goes to yPercent 101 with back.inOut(1.7) and a 0.05 stagger; the new one starts from -101. If the word is wider than the stage, the type shrinks by itself.

The bag that spins and lands

The bag is two elements: the outer one travels (x of 30 hundredths of the width, y of 110 hundredths of the height, rotation of 180 degrees, sine.in leaving and sine.out arriving, with the measures in functions taken again on resize), the inner one, pivoting at the bottom, does the landing: one pixel lower and three sways that die out. This way the two movements never cancel each other.

The shadow and the ground

The shadow is an oval with a blurred radial gradient: when the bag leaves it goes to zero opacity and scale 0.6, when it lands it goes to 1.16 and back to 1 with back.out(2). The ground and the type colour are two CSS variables, --bg and --ink, that GSAP blends from one colour to the next: all the type, the button ring and the pill of the row follow them by themselves.

The bag in SVG

One drawing for the four flavours, with the colour in a variable: the body, the zigzag seal made by a loop, the crimp with a pattern of lines, and on top three shared layers of light (a gradient dark at the sides and light at a quarter, one from top to bottom, the reflection blurred with feGaussianBlur). The two-layer shadow is a drop-shadow on the SVG.

Values to change

NameFileDefaultWhat it changes
RIDEscript.js1How much scroll the four flavours take: 2 is twice as long.
SCRUBscript.js1How many seconds the stage lags behind the scroll (the site uses 1.4).
SPINscript.js180Degrees the bag turns leaving and arriving.
DRIFTscript.js30How far sideways the bag travels, in hundredths of the width.
WOBBLEscript.js3Degrees of the sway when the bag lands.
CHAR_STAGGERscript.js0.05Delay between the letters of the giant word.
SHADOWscript.js0.42How dark the shadow under the bag is.
GRAINscript.js0.1How much grain on the colour of the ground.

Try them in the Playground

When to use it

For the product showcase of a brand with a few strong variants: the flavours of a snack, a drink or an ice cream, the colours of a bottle, the blends of a coffee. Each variant has its own colour and word, and whoever scrolls sees them one at a time without leaving the page.

On phones

The same: the giant word is sized with min(26vw, 34vh) and shrinks if it goes past the sides, the bag with min(48vh, 66vw), the row of flavours and the mark tighten with the screen. The stage is 100lvh tall, so on Safari it does not jump when the bar hides.

With reduced motion

No falling letters and no spinning bags: scrolling, one flavour fades into the next in place, the ground changes colour and the round in the row moves.

Pitfalls

  • With the giant word’s tight line-height the glyphs overflow their box: moved by 101% they still showed a few pixels above the mask. The letters have line-height 1.
  • ScrollTrigger’s onUpdate fires when you scroll, not while the scrub catches up: the active flavour in the row lagged behind and its label took the colour of the ground. The timeline’s onUpdate is followed instead.
  • The opening and the scroll timeline move the same bag: the opening works on the inner elements, the scroll on the outer ones, so they never cancel each other.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Archivo (font variabile) 5.3.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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