Image Trail
v1.0.0Images follow the pointer and fade behind it. Each one pops in, leans the way the pointer is moving and drifts off, and a fast stroke fills its gaps so the trail never breaks up. It reads the shared pointer sensor, reuses a fixed set of images and keeps fewer in the air on a slow device. Does nothing under reduced motion.
Installation
Run once in your project root to configure paths and dependencies:
npx vectorvesper initDownloads and registers the component in your project:
npx vectorvesper add image-trailIf installing manually or managing your package lock:
npm install @vectorvesper/motionUsage
A portfolio, studio or campaign hero where the work itself should come out to meet the visitor. Put your headline in as children; the trail passes over it.
Import
Usage
Do
- Use small images cut to the same shape, around 400 px wide. Every move can bring a new one in, so a large file arrives late.
- Give it eight or more images, so the same one doesn't come round too often.
Don't
- Do not put it behind links or buttons people need to click; the trail passes over them. It never blocks the pointer, but it hides what is under it.
prefers-reduced-motion and provides a graceful fallback.Props
Images follow the pointer and fade behind it. Each one pops in, leans the way the pointer is moving and drifts off, and a fast stroke fills its gaps so the trail stays even.
<ImageTrail />
The area the trail runs in, with your content laid under it. 100svh tall unless you size it.
| Prop | Type | Default | Description |
|---|---|---|---|
images* | (string | { src: string; alt?: string })[] | — | Images the pointer leaves behind, used in order. |
size | number | 180 | Width of each image in px on a wide area. It shrinks on a narrow one. |
ratio | number | 1.25 | Height over width. 1.25 is a 4:5 portrait. |
spacing | number | 80 | Pointer travel in px between images. |
duration | number | 1400 | How long each image stays, in ms. |
max | number | 14 | Most images on screen at once. Fewer on a slow device. |
radius | number | 6 | Corner radius in px. |
mount | "auto" | "eager" | "auto" | "auto" waits for a quiet moment to start; "eager" starts at once. |
className | string | — | Sizes the area. Without a height it is 100svh tall. |
style | React.CSSProperties | — | Inline styles for the area. A height here wins over the default. |
children | React.ReactNode | — | Content laid under the trail. |