Skip to content

Design3 min read

How to Create a Star Trail Cursor in Webflow

Learn how to create a cursor with a trail of colorful stars in Webflow using JavaScript.

In this tutorial, Sandro, cofounder of Gemeos Webflow agency, shows you how to create a cursor with a trail of colorful stars in Webflow.

Example

Move your mouse inside the area

✨ Move your mouse here
ParameterDefault valueDescription
COUNT12Number of stars in the trail
SIZE10Star size in pixels
COLORSPurple, pink, blue...Star colors

The script

Paste this script into the Footer code field of your CMS article. It runs automatically on the page.

(function() {
  var COUNT = 12, SIZE = 10;
  var COLORS = ['#a78bfa','#f472b6','#60a5fa','#34d399','#fbbf24'];
  var stars = [];
  for (var i = 0; i < COUNT; i++) {
    var s = document.createElement('div');
    s.style.cssText = 'position:fixed;pointer-events:none;border-radius:50%;z-index:9999;transition:opacity 0.3s;';
    document.body.appendChild(s);
    stars.push({ el: s, x: 0, y: 0 });
  }
  document.addEventListener('mousemove', function(e) {
    var s = stars[Math.floor(Math.random() * COUNT)];
    var color = COLORS[Math.floor(Math.random() * COLORS.length)];
    var size = SIZE * (0.5 + Math.random() * 0.5);
    s.el.style.cssText += 'width:'+size+'px;height:'+size+'px;background:'+color+';left:'+e.clientX+'px;top:'+e.clientY+'px;opacity:1;';
    setTimeout(function() { s.el.style.opacity = '0'; }, 100);
  });
})();

Conclusion

A subtle but eye-catching easter egg. Perfect for creative sites and portfolios. See also: create a custom cursor in Webflow.

Published on May 19, 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 !!