Skip to content

Easter egg3 min read

How to Play a Level-Up Sound at the End of an Article in Webflow

Learn how to play a level-up sound when a visitor finishes reading a Webflow article with the Web Audio API.

In this tutorial, Sandro, cofounder of Gemeos Webflow agency, shows you how to play a level-up sound when a visitor finishes reading a Webflow article, using the Web Audio API.

Example

🎮

Level-up sound

Do Mi Sol Do — Web Audio API

Do 523Hz Mi 659Hz Sol 784Hz Do 1047Hz

Click to test

NoteFrequencyTiming
Do523 Hz0ms
Mi659 Hz120ms
Sol784 Hz240ms
Do (high)1047 Hz360ms, held 300ms

Understanding the melody

The Do-Mi-Sol-Do melody is the chord progression most universally recognized as a "victory" sound in gaming culture. It uses the Web Audio API's square oscillator for a retro 8-bit feel. No audio file is needed: everything is generated synthetically.

1. Add a level-up badge (optional)

Create a Div with the ID levelup-badge, set it to Fixed position, center it, and keep it hidden by default with display none. Add a message like "⬆ Level Up ! Article complete" in your own style.

(function() {
  var fired = false;

  function playLevelUp() {
    var AudioCtx = window.AudioContext || window.webkitAudioContext;
    if (!AudioCtx) return;
    var ctx = new AudioCtx();

    // Level-up melody: do-mi-sol-do (upper octave)
    var notes = [
      { freq: 523, start: 0, dur: 0.1 },    // Do
      { freq: 659, start: 0.12, dur: 0.1 },  // Mi
      { freq: 784, start: 0.24, dur: 0.1 },  // Sol
      { freq: 1047, start: 0.36, dur: 0.3 }, // Do (high)
    ];

    notes.forEach(function(note) {
      var osc = ctx.createOscillator();
      var gain = ctx.createGain();
      osc.connect(gain);
      gain.connect(ctx.destination);
      osc.type = 'square';
      osc.frequency.setValueAtTime(note.freq, ctx.currentTime + note.start);
      gain.gain.setValueAtTime(0.15, ctx.currentTime + note.start);
      gain.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + note.start + note.dur);
      osc.start(ctx.currentTime + note.start);
      osc.stop(ctx.currentTime + note.start + note.dur + 0.01);
    });
  }

  window.addEventListener('scroll', function() {
    if (fired) return;
    var scrolled = window.scrollY + window.innerHeight;
    var total = document.documentElement.scrollHeight;
    if (scrolled >= total - 100) {
      fired = true;
      playLevelUp();
      var el = document.getElementById('levelup-badge');
      if (el) {
        el.style.display = 'flex';
        setTimeout(function() {
          el.style.opacity = '0';
          el.style.transition = 'opacity 0.5s';
          setTimeout(function() { el.style.display = 'none'; }, 500);
        }, 3000);
      }
    }
  }, { passive: true });
})();

3. Combine it with confetti

For a complete experience, load canvas-confetti in the head and add this inside the triggerEnd function:

if (typeof confetti === 'function') {
  confetti({ particleCount: 80, angle: 60, spread: 55, origin: { x: 0, y: 0.8 } });
  confetti({ particleCount: 80, angle: 120, spread: 55, origin: { x: 1, y: 0.8 } });
}

Conclusion

A level-up sound creates a memorable moment and reinforces the feeling of accomplishment. Use cases:

  • Long technical articles that reward finishing the read
  • Tutorials with gamification
  • Academies and training platforms

Published on May 20, 2026

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

Let’s f*****G GO !!