Mouse Trail
Scia del cursore · Estela del cursor · Cursor trail · Pointer trail · Scia del mouse
A trail of dots, lines or images follows the pointer and then fades away. Born as a gimmick on 90s personal homepages, it is back in a fluid form on creative sites.
- Era
- 1997 – today
- Use
- Niche
Live demo
View code
<main><h1>Lascia una<br>scia</h1><p>muovi il mouse qui sopra</p></main>
<div id="t" aria-hidden="true"></div>
<script>
const t=document.getElementById('t'),N=22,pts=[],els=[];
for(let i=0;i<N;i++){const e=document.createElement('i'),k=i/(N-1),s=26*(1-k)+4;
e.style.cssText=`width:${s}px;height:${s}px;margin:${-s/2}px 0 0 ${-s/2}px;opacity:${1-k*.85};background:hsl(${340+k*150},95%,62%)`;
t.append(e);els.push(e);pts.push({x:innerWidth*(.2+k*.5),y:innerHeight*(.75-k*.1)})}
const draw=()=>els.forEach((e,i)=>e.style.transform=`translate(${pts[i].x}px,${pts[i].y}px)`);
if(matchMedia('(prefers-reduced-motion: no-preference)').matches){
let x=innerWidth/2,y=innerHeight/2,idle=true,a=0;
addEventListener('pointermove',e=>{idle=false;x=e.clientX;y=e.clientY});
(function f(){if(idle){a+=.03;x=innerWidth/2+Math.sin(a)*innerWidth*.34;y=innerHeight/2+Math.sin(a*2)*innerHeight*.3}
pts[0].x=x;pts[0].y=y;for(let i=1;i<N;i++){pts[i].x+=(pts[i-1].x-pts[i].x)*.42;pts[i].y+=(pts[i-1].y-pts[i].y)*.42}
draw();requestAnimationFrame(f)})();
}else{t.classList.add('still');draw()}
</script> body{margin:0;height:100vh;display:grid;place-items:center;background:radial-gradient(circle at 50% 120%,#24123A,#0B0B12 60%);color:#F2EEF8;overflow:hidden;font-family:Inter,sans-serif}
main{text-align:center;position:relative;z-index:1;pointer-events:none}
h1{font:800 clamp(42px,10vw,78px)/.92 'Bricolage Grotesque',sans-serif;margin:0;letter-spacing:-.03em}
p{margin:14px 0 0;font-size:13px;letter-spacing:.12em;text-transform:uppercase;color:#9A93AE}
#t i{position:fixed;left:0;top:0;border-radius:50%;pointer-events:none;mix-blend-mode:screen;box-shadow:0 0 18px currentColor}
#t.still{opacity:.6} Characteristics
- Chain of elements chasing each other with growing lag
- Size and opacity shrinking toward the tail
- Colours shifting along the trail
- Variant with images popping in and fading
- Mouse devices only
Palette
Click a swatch to copy it
Typography
Headings · Bricolage Grotesque Mouse Trail
Body · Inter A trail of dots, lines or images follows the pointer and then fades away. Born as a gimmick on 90s personal homepages, it is back in a fluid form on creative sites.
Motion
- Easing
lerp 0.25–0.5 tra un punto e il successivo (requestAnimationFrame)- Typical duration
- continuo; dissolvenza della coda 300–800 ms
- Techniques
- requestAnimationFrame con catena di lerp, Canvas 2D con disegno a scia, pointermove, transform translate3d, SVG polyline aggiornata a ogni frame, @media (hover: hover) and (pointer: fine)
Accessibility (reduced motion)
No trail; keep the system cursor or a single custom pointer that tracks without lag.
Prompt for your agent
Copy and paste into your prompt to have an agent or image generator reproduce this style.
For web pages and UI
Design the web page or interface in this style: Mouse Trail (Scia del cursore, Estela del cursor). A trail of dots, lines or images follows the pointer and then fades away. Born as a gimmick on 90s personal homepages, it is back in a fluid form on creative sites. Characteristics: Chain of elements chasing each other with growing lag, Size and opacity shrinking toward the tail, Colours shifting along the trail, Variant with images popping in and fading, Mouse devices only. Palette: #0B0B12, #F2EEF8, #FF3D7F, #FFD23F, #3DF5C9. Typography: headings in Bricolage Grotesque, body text in Inter (Google Fonts or equivalents). Mood: playful, energetic, nostalgic. Motion: easing lerp 0.25–0.5 tra un punto e il successivo (requestAnimationFrame), typical duration continuo; dissolvenza della coda 300–800 ms; techniques: requestAnimationFrame con catena di lerp, Canvas 2D con disegno a scia, pointermove, transform translate3d, SVG polyline aggiornata a ogni frame, @media (hover: hover) and (pointer: fine). With prefers-reduced-motion: No trail; keep the system cursor or a single custom pointer that tracks without lag. References: scie del cursore delle pagine GeoCities, Codrops «Image Trail Effects», siti premiati su Awwwards, MDN «requestAnimationFrame».
Relations
Derives from
References
- scie del cursore delle pagine GeoCities
- Codrops «Image Trail Effects»
- siti premiati su Awwwards
- MDN «requestAnimationFrame»