Skip to content
animorio
IT
Back to the library

Sound mixer toggle

Scroll, HoverGSAP, CSS onlyAdvancedCompressed weight: Demo 13 KBGSAP + ScrollTrigger + CustomEase 49 KBFreeDownload the zip

Scroll inside the preview

The page of a made-up sports club, Vantmoor Athletic Club, with four sections, ride, court, swim and run, and in a corner a frosted glass mixer with the Sounds switch. Every section has its own sound, synthesised live with WebAudio, and its volume rises as it comes in and falls as it leaves on a triangle, 1 − |2p − 1|, while you scroll. The segmented bars, the peaks falling slowly, the volume as a number and the loudest section lit show even with the sounds off, fainter; on a click the ball slides on its spring and the mixer comes alive.

Rebuilt from scratch studying champions4good.club by Double Play: 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>
<!--
  "Sound mixer toggle" 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>Vantmoor Athletic Club, club mix</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/big-shoulders-display@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/inter-tight@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the club page of a made-up sports club, Vantmoor Athletic Club: four sections, ride, court, swim and run. In the
       corner a frosted glass mixer with the Sounds switch: every section has its own loop, synthesised live with
       WebAudio, and its volume rises and falls with the scroll on a triangle, 1 - |2p - 1|. The strips show it even
       with the sounds off, fainter. -->
  <header class="brand" aria-label="Vantmoor Athletic Club">
    <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
      <path d="M3 6.5 12 18l9-11.5"/>
      <path d="M7.4 6.5 12 12.4l4.6-5.9"/>
    </svg>
    <span class="brand__name">Vantmoor <em>Athletic Club</em></span>
  </header>

  <main>
    <section class="sport" data-sport="ride" style="--accent: var(--ride)">
      <svg class="sport__lines" data-lines viewBox="0 0 600 600" aria-hidden="true">
        <circle cx="300" cy="300" r="250"/>
        <circle cx="300" cy="300" r="232"/>
        <circle cx="300" cy="300" r="26"/>
        <g data-spin>
          <path d="M300 74v452M74 300h452M140 140l320 320M460 140 140 460M213 91l174 418M387 91 213 509M91 213l418 174M91 387l418-174"/>
        </g>
      </svg>
      <div class="sport__head">
        <p class="sport__tag"><span>Saturday club ride</span><span class="sport__time">07:00</span></p>
        <h2 class="sport__title" data-title>Ride</h2>
        <p class="sport__line">Sixty four kilometres out to the reservoir and back. Coffee at the turn.</p>
      </div>
      <dl class="sport__stats">
        <div><dt>Distance</dt><dd>64 km</dd></div>
        <div><dt>Riders</dt><dd>38</dd></div>
        <div><dt>Climb</dt><dd>610 m</dd></div>
      </dl>
    </section>

    <section class="sport" data-sport="court" style="--accent: var(--court)">
      <svg class="sport__lines" data-lines viewBox="0 0 600 600" aria-hidden="true">
        <rect x="120" y="40" width="360" height="520"/>
        <path d="M165 40v520M435 40v520M165 170h270M165 430h270M300 170v260"/>
        <path class="sport__net" d="M100 300h400"/>
      </svg>
      <div class="sport__head">
        <p class="sport__tag"><span>Tuesday doubles</span><span class="sport__time">19:30</span></p>
        <h2 class="sport__title" data-title>Court</h2>
        <p class="sport__line">Four hard courts under the lights and a ladder that resets every month.</p>
      </div>
      <dl class="sport__stats">
        <div><dt>Courts</dt><dd>4</dd></div>
        <div><dt>Players</dt><dd>16</dd></div>
        <div><dt>Rounds</dt><dd>3 sets</dd></div>
      </dl>
    </section>

    <section class="sport" data-sport="swim" style="--accent: var(--swim)">
      <svg class="sport__lines" data-lines viewBox="0 0 600 600" aria-hidden="true">
        <g data-lanes>
          <path d="M-40 120h680M-40 210h680M-40 300h680M-40 390h680M-40 480h680"/>
          <path class="sport__dash" d="M-40 165h680M-40 255h680M-40 345h680M-40 435h680"/>
        </g>
      </svg>
      <div class="sport__head">
        <p class="sport__tag"><span>Open lanes, early</span><span class="sport__time">06:15</span></p>
        <h2 class="sport__title" data-title>Swim</h2>
        <p class="sport__line">Fifty metres and eight lanes at 27 degrees, before the city wakes up.</p>
      </div>
      <dl class="sport__stats">
        <div><dt>Pool</dt><dd>50 m</dd></div>
        <div><dt>Lanes</dt><dd>8</dd></div>
        <div><dt>Set</dt><dd>2.4 km</dd></div>
      </dl>
    </section>

    <section class="sport" data-sport="run" style="--accent: var(--run)">
      <svg class="sport__lines" data-lines viewBox="0 0 600 600" aria-hidden="true">
        <path d="M190 60h220a240 240 0 0 1 0 480H190a240 240 0 0 1 0-480Z"/>
        <path d="M190 100h220a200 200 0 0 1 0 400H190a200 200 0 0 1 0-400Z"/>
        <path d="M190 140h220a160 160 0 0 1 0 320H190a160 160 0 0 1 0-320Z"/>
        <path class="sport__dash" d="M300 40v100"/>
      </svg>
      <div class="sport__head">
        <p class="sport__tag"><span>Thursday tempo</span><span class="sport__time">18:45</span></p>
        <h2 class="sport__title" data-title>Run</h2>
        <p class="sport__line">Ten kilometres along the river, with a pace group for every pace.</p>
      </div>
      <dl class="sport__stats">
        <div><dt>Distance</dt><dd>10 km</dd></div>
        <div><dt>Runners</dt><dd>52</dd></div>
        <div><dt>Pace</dt><dd>4:50</dd></div>
      </dl>
    </section>
  </main>

  <aside class="mixer" data-mixer aria-label="Club mix">
    <span class="mixer__grain" aria-hidden="true"></span>
    <span class="mixer__shine" aria-hidden="true"></span>
    <div class="mixer__top">
      <p class="mixer__name">Club mix <span class="mixer__state" data-state>muted</span></p>
      <button class="sound" type="button" aria-pressed="false" aria-label="Turn the sounds on and off" data-toggle>
        <span class="sound__words" aria-hidden="true">
          <span class="sound__text sound__text--a" data-split>Sounds</span>
          <span class="sound__text sound__text--b" data-split>Sounds</span>
        </span>
        <span class="sound__track" aria-hidden="true">
          <span class="sound__fill"></span>
          <span class="sound__knob" data-knob><span class="sound__ball" data-ball></span></span>
        </span>
      </button>
    </div>
    <div class="mixer__strips" data-strips>
      <div class="strip" data-strip style="--accent: var(--ride)">
        <span class="strip__glow" aria-hidden="true"></span>
        <span class="strip__num" data-num>0</span>
        <span class="strip__meter" data-meter aria-hidden="true"></span>
        <span class="strip__name">Ride</span>
        <span class="strip__sub" data-sub>wind</span>
      </div>
      <div class="strip" data-strip style="--accent: var(--court)">
        <span class="strip__glow" aria-hidden="true"></span>
        <span class="strip__num" data-num>0</span>
        <span class="strip__meter" data-meter aria-hidden="true"></span>
        <span class="strip__name">Court</span>
        <span class="strip__sub" data-sub>rally</span>
      </div>
      <div class="strip" data-strip style="--accent: var(--swim)">
        <span class="strip__glow" aria-hidden="true"></span>
        <span class="strip__num" data-num>0</span>
        <span class="strip__meter" data-meter aria-hidden="true"></span>
        <span class="strip__name">Swim</span>
        <span class="strip__sub" data-sub>surface</span>
      </div>
      <div class="strip" data-strip style="--accent: var(--run)">
        <span class="strip__glow" aria-hidden="true"></span>
        <span class="strip__num" data-num>0</span>
        <span class="strip__meter" data-meter aria-hidden="true"></span>
        <span class="strip__name">Run</span>
        <span class="strip__sub" data-sub>steps</span>
      </div>
    </div>
    <svg class="mixer__map" viewBox="0 0 400 24" preserveAspectRatio="none" aria-hidden="true" data-map>
      <path class="mixer__base" d="M0 23.5h400"/>
      <line class="mixer__head" x1="0" y1="0" x2="0" y2="24" data-head/>
    </svg>
  </aside>

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

80 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 “Sound mixer toggle” 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 an almost solid #0b0c0e black, under a veil of grain, the page of Vantmoor Athletic Club: the mark at the top left, two line Vs one inside the other, and four sections a screen tall. Each has its colour: Ride in mint, Court in ball yellow, Swim in pool blue, Run in track orange. A label with the day and the time in a pill (‘Saturday club ride’, 07:00), the sport's name huge in a condensed face with its last letter in the section's colour, a line of text and at the bottom three figures split by a hairline (64 km, 38 riders, 610 m of climbing). Behind, in thin lines, the spoked wheel, the court with its net, the lanes with their dashed ropes, the oval track: they turn or drift slowly with the scroll and light up when their section is in the middle. The title letters come in from 80 pixels to the right, leaning 14 degrees and a hair squashed, and straighten one after the other as the section rises. At the bottom right, still, a frosted glass mixer with an edge that catches the light, a glint at its top in the colour of the loudest section and a three layer shadow: ‘Club mix muted’ and the Sounds switch, a pill with the word and a track with a glossy ball. Below, four strips: the volume as a number, a bar of fourteen segments with the top three in the sport's colour, the name and a small word (wind, rally, surface, steps). As you scroll, each section's volume follows the triangle: zero as it comes in from the bottom, a hundred when it fills the screen, zero as it leaves at the top, so two neighbouring sections hand the sound over. The bars rise and fall in rhythm (the tennis hits, the running steps, the strokes), the peak stays up for 0.7 seconds and then falls five segments a second, and the loudest strip lights up in its colour. With the sounds off all of this is there, greyer and fainter. On hover the word Sounds slips away to the left, leaning, and a copy comes in from the right, letter by letter; pressed, the switch squashes; on a click the ball slides in half a second along the site's curve, stretches as it leaves, lands a pixel too far and comes back, the track fills with the section's colour and ‘muted’ turns into ‘live’. Then you hear the sounds, all made live: the wind and the hum of the tyres with the freewheel ticking, a dry tennis rally from left to right with its bounces, strokes and splashes that halfway down the pool turn into the muffled rumble and bubbles under water, footsteps on gravel with a breath every four.

How it works

The volume triangle

As on the site, each section has a ScrollTrigger from ‘top bottom’ to ‘bottom top’: the progress p goes from 0 as the section peeks in from the bottom to 1 as it leaves at the top, and the volume is 1 − |2p − 1|, a triangle reaching 1 when the section fills the screen. With sections a screen tall, the volumes of two neighbours always add up to 1: the sound hands over with no gap.

A volume that chases

The triangle does not go straight into the sound: a gsap.quickTo with power2 over 0.2 seconds (SMOOTH) chases it, as the site does with the running man of its logo. That number drives the channel's gain (setTargetAtTime, no clicks), the strip's figure, the section's glow and the glow of the sport's lines.

Two sounds in one section

The site splits some sections into halves or thirds with an 18 % ramp. Here the pool goes from the surface to under water: around the middle of the progress, 18 % of half a section wide (FADE), a smoothstep curve lowers the strokes and raises the filtered rumble and the bubbles, and the strip's small word changes from surface to under.

Sounds made live

No files: a two second buffer of white noise and a few oscillators. The bike is noise in a slowly moving band pass, a low pass for the tyres and 22 millisecond high pass clicks for the freewheel; tennis a triangle from 430 to 170 Hz with a burst of noise at 1900 Hz, left and right; running a sine from 115 to 42 Hz and the crunch of gravel. Events are scheduled 0.2 seconds ahead on the audio clock, inside gsap.ticker, and only for the channels you can hear.

Bars, peaks and the ball

With the sounds on, the level comes from one AnalyserNode per channel (the RMS, normalised on its own); off, from the same rhythm worked out, so the mixer reads the same. The bar rises fast and falls slower, the peak waits PEAK_HOLD and falls PEAK_FALL segments a second. The switch carries aria-pressed like the site's; the ball travels on the cubic-bezier(.32, .72, 0, 1) curve in 0.5 seconds, a pixel too far and back, while the sphere inside stretches and comes back with elastic.out: one element for the travel, its child for the shape.

Values to change

NameFileDefaultWhat it changes
LOUDNESSscript.js0.8The master volume with the sounds on, 0 to 1.
SMOOTHscript.js0.2Seconds the volume takes to follow the scroll (quickTo, power2, like the site).
FADEscript.js0.18The ramp of the crossfade between the two pool sounds, as a share of half a section (the site uses 18 %).
SLIDEscript.js0.5Seconds the ball takes to cross the switch (the site uses 0.5).
SQUASHscript.js0.3How much the ball stretches as it leaves.
SEGMENTSscript.js14The segments in each bar of the mixer.
PEAK_HOLDscript.js0.7Seconds a peak waits before it falls.
PEAK_FALLscript.js5Segments per second a peak falls.
TITLE_SKEWscript.js-14Degrees the title letters lean as they come in (the site uses −14).
TITLE_SHIFTscript.js80Pixels the title letters come in from (the site uses 80).
TEMPOscript.js1The speed of every loop: 1.2 is a faster ride, rally and run.

Try them in the Playground

When to use it

For the page of a sports club, a gym, a festival or an event with several disciplines, for the launch of a product with a sound (headphones, an electric car, an instrument), for a story site split into chapters: when every part of the page has a mood and the sound should follow whoever scrolls, but stay off until asked.

On phones

The same animation with adapted sizes: the sections stay a screen tall, the title is sized on the height too, the three figures stack in a column to the left of the mixer, which narrows and shortens its bars. The sounds can be turned on with a finger too (the site keeps them to the computer); the word does not slip away on hover, the press and the ball's spring stay the same.

With reduced motion

No movement: the title letters and the copy only fade in, the sport lines stay still, the ball jumps to its place, the word Sounds changes with a fade. The volume, the sounds and the mixer bars work the same: they are the data, not a motion.

Pitfalls

  • The browser will not start audio without a gesture: the AudioContext is created and resumed only inside the click on the switch, never on load.
  • The triangle's volume changes on every scroll event: written straight into the gain it clicks. It is chased (quickTo) and then passed on with setTargetAtTime.
  • With the sounds off the AudioContext is suspended after the fade, not at once: an immediate suspend cuts the sound halfway with a click.
  • Rhythmic events are not timed with setTimeout (the preview's own stage does not drive it and skips): they are scheduled on the audio clock, a little ahead, inside gsap.ticker.
  • On load the first section already has a progress of 0.5 (it is at the top): its ScrollTrigger must write the volume on refresh too, not only on scroll, or the mixer starts at zero.
  • GSAP moves the ball and its transform would wipe out the CSS one: the travel sits on the wrapper, the stretch on the sphere inside.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, CustomEase 3.15.0, Big Shoulders Display (font variabile) 5.3.0, Inter Tight (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 13 KB; the libraries: GSAP + ScrollTrigger + CustomEase 49 KB.

Testing

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