Scroll Image Trail is an interactive React wrapper that drops image clones behind the cursor as it moves across the wrapped surface. Each image cycles through the supplied list in order, picks up a small random rotation, and fades out after a configurable lifetime; a hard cap on the number alive at once keeps the DOM bounded regardless of cursor velocity.
Pairs well with portfolio openers, gallery entrances, or "scroll to explore" sections.
Installation
Usage
import { ScrollImageTrail } from "@/components/ui/scroll-image-trail";
const IMAGES = ["/gallery/a.jpg", "/gallery/b.jpg", "/gallery/c.jpg"];
export function Example() {
return (
<ScrollImageTrail images={IMAGES} className="h-80 w-full rounded-xl">
<p className="p-12 text-center">move the cursor</p>
</ScrollImageTrail>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
images | string[] | — | Image URLs to cycle through along the trail. |
children | ReactNode | — | The content inside the interactive area. |
imageWidth | number | 160 | Rendered image width in pixels (height auto-scales). |
distance | number | 70 | Pixels the cursor must move before dropping the next image. |
maxTrail | number | 5 | Max images alive at once. |
lifetimeMs | number | 900 | How long each image stays before fading out. |
className | string | — | Extra classes on the outer wrapper. |
imageClassName | string | — | Extra classes on each trail image (e.g. aspect-3/4 to crop to one shape). |
Related components
- Audio Waveform
A live frequency visualiser for an HTML audio source, driven by WebAudio's AnalyserNode. Bars or waveform mode.
- 3D Layered Card
A 3D card with layered effects and animations.
- Animated Code Block
Code snippets with typing and highlighting effects.
- Bubble Background
An interactive floating bubble animation for backgrounds.
