ImageTrailCursor
Trail of images that spawn and animate along the cursor's path, powered by GSAP timelines, with 18 selectable variants: fades, momentum drift, rotation flings, 3D perspective tilt, a hard-edge pixelated snap, a bouncy scale pop, images that fall or bounce under gravity, a flame flicker, and five fragment reveals (venetian, curtain, hexagon, liquid, zoom split)
Available for Svelte 5, React, and Vue 3.
Preview
<script lang="ts">
import { ImageTrailCursor } from "fancy-ui-svelte";
import type { VariantType } from "fancy-ui-svelte";
const images = [
"https://picsum.photos/seed/trail1/400/440",
"https://picsum.photos/seed/trail2/400/440",
"https://picsum.photos/seed/trail3/400/440",
"https://picsum.photos/seed/trail4/400/440",
"https://picsum.photos/seed/trail5/400/440",
"https://picsum.photos/seed/trail6/400/440",
"https://picsum.photos/seed/trail7/400/440",
"https://picsum.photos/seed/trail8/400/440",
];
const variants: { type: VariantType; label: string }[] = [
{ type: "type1", label: "Fade & Scale" },
{ type: "type2", label: "Brightness" },
{ type: "type3", label: "Float-up" },
{ type: "type4", label: "Momentum" },
{ type: "type5", label: "Rotation" },
{ type: "type6", label: "Speed-reactive" },
{ type: "type7", label: "Stacking" },
{ type: "type8", label: "3D Perspective" },
{ type: "pixelated", label: "Pixelated" },
{ type: "scale", label: "Scale" },
{ type: "fall", label: "Image fall" },
{ type: "gravity", label: "Gravity" },
{ type: "flame", label: "Flame" },
{ type: "venetian", label: "Venetian" },
{ type: "curtain", label: "Curtain" },
{ type: "hexagon", label: "Hexagon" },
{ type: "liquid", label: "Liquid" },
{ type: "zoom-split", label: "Zoom split" },
];
let selectedVariant: VariantType = $state("type1");
</script>
<div class="w-full">
<div class="mb-4 flex flex-wrap gap-2">
{#each variants as v}
<button
class="rounded-lg border px-3 py-1.5 text-sm transition-colors {selectedVariant === v.type
? 'border-primary bg-primary text-primary-foreground'
: 'border-border bg-card hover:bg-accent'}"
onclick={() => (selectedVariant = v.type)}
>
{v.label}
</button>
{/each}
</div>
<div class="relative h-[500px] cursor-crosshair overflow-hidden rounded-lg border">
<ImageTrailCursor {images} variant={selectedVariant} />
<div class="pointer-events-none absolute inset-0 flex items-center justify-center">
<p class="text-muted-foreground text-lg font-medium select-none">Move your cursor here</p>
</div>
</div>
</div>Installation
Usage
<script lang="ts">
import { ImageTrailCursor } from "fancy-ui-svelte";
import type { VariantType } from "fancy-ui-svelte";
const images = [
"https://picsum.photos/seed/trail1/400/440",
"https://picsum.photos/seed/trail2/400/440",
"https://picsum.photos/seed/trail3/400/440",
"https://picsum.photos/seed/trail4/400/440",
"https://picsum.photos/seed/trail5/400/440",
"https://picsum.photos/seed/trail6/400/440",
"https://picsum.photos/seed/trail7/400/440",
"https://picsum.photos/seed/trail8/400/440",
];
const variants: { type: VariantType; label: string }[] = [
{ type: "type1", label: "Fade & Scale" },
{ type: "type2", label: "Brightness" },
{ type: "type3", label: "Float-up" },
{ type: "type4", label: "Momentum" },
{ type: "type5", label: "Rotation" },
{ type: "type6", label: "Speed-reactive" },
{ type: "type7", label: "Stacking" },
{ type: "type8", label: "3D Perspective" },
{ type: "pixelated", label: "Pixelated" },
{ type: "scale", label: "Scale" },
{ type: "fall", label: "Image fall" },
{ type: "gravity", label: "Gravity" },
{ type: "flame", label: "Flame" },
{ type: "venetian", label: "Venetian" },
{ type: "curtain", label: "Curtain" },
{ type: "hexagon", label: "Hexagon" },
{ type: "liquid", label: "Liquid" },
{ type: "zoom-split", label: "Zoom split" },
];
let selectedVariant: VariantType = $state("type1");
</script>
<div class="w-full">
<div class="mb-4 flex flex-wrap gap-2">
{#each variants as v}
<button
class="rounded-lg border px-3 py-1.5 text-sm transition-colors {selectedVariant === v.type
? 'border-primary bg-primary text-primary-foreground'
: 'border-border bg-card hover:bg-accent'}"
onclick={() => (selectedVariant = v.type)}
>
{v.label}
</button>
{/each}
</div>
<div class="relative h-[500px] cursor-crosshair overflow-hidden rounded-lg border">
<ImageTrailCursor {images} variant={selectedVariant} />
<div class="pointer-events-none absolute inset-0 flex items-center justify-center">
<p class="text-muted-foreground text-lg font-medium select-none">Move your cursor here</p>
</div>
</div>
</div>Examples
Basic Usage
<script lang="ts">
import { ImageTrailCursor } from "$lib/fancy-ui/image-trail-cursor";
import type { VariantType } from "$lib/fancy-ui/image-trail-cursor";
const images = [
"https://picsum.photos/seed/trail1/400/440",
"https://picsum.photos/seed/trail2/400/440",
"https://picsum.photos/seed/trail3/400/440",
"https://picsum.photos/seed/trail4/400/440",
"https://picsum.photos/seed/trail5/400/440",
"https://picsum.photos/seed/trail6/400/440",
"https://picsum.photos/seed/trail7/400/440",
"https://picsum.photos/seed/trail8/400/440",
];
const variants: { type: VariantType; label: string }[] = [
{ type: "type1", label: "Fade & Scale" },
{ type: "type2", label: "Brightness" },
{ type: "type3", label: "Float-up" },
{ type: "type4", label: "Momentum" },
{ type: "type5", label: "Rotation" },
{ type: "type6", label: "Speed-reactive" },
{ type: "type7", label: "Stacking" },
{ type: "type8", label: "3D Perspective" },
{ type: "pixelated", label: "Pixelated" },
{ type: "scale", label: "Scale" },
{ type: "fall", label: "Image fall" },
{ type: "gravity", label: "Gravity" },
{ type: "flame", label: "Flame" },
{ type: "venetian", label: "Venetian" },
{ type: "curtain", label: "Curtain" },
{ type: "hexagon", label: "Hexagon" },
{ type: "liquid", label: "Liquid" },
{ type: "zoom-split", label: "Zoom split" },
];
let selectedVariant: VariantType = $state("type1");
</script>
<div class="w-full">
<div class="mb-4 flex flex-wrap gap-2">
{#each variants as v}
<button
class="rounded-lg border px-3 py-1.5 text-sm transition-colors {selectedVariant === v.type
? 'border-primary bg-primary text-primary-foreground'
: 'border-border bg-card hover:bg-accent'}"
onclick={() => (selectedVariant = v.type)}
>
{v.label}
</button>
{/each}
</div>
<div class="relative h-[500px] cursor-crosshair overflow-hidden rounded-lg border">
<ImageTrailCursor {images} variant={selectedVariant} />
<div class="pointer-events-none absolute inset-0 flex items-center justify-center">
<p class="text-muted-foreground text-lg font-medium select-none">Move your cursor here</p>
</div>
</div>
</div>Animation Variants
18 trail animation styles: fades and drifts, a pixelated snap, scale/fall/gravity/flame, and five fragment reveals.
<script lang="ts">
import { ImageTrailCursor } from "$lib/fancy-ui/image-trail-cursor";
import type { VariantType } from "$lib/fancy-ui/image-trail-cursor";
const images = [
"https://picsum.photos/seed/trail1/400/440",
"https://picsum.photos/seed/trail2/400/440",
"https://picsum.photos/seed/trail3/400/440",
"https://picsum.photos/seed/trail4/400/440",
"https://picsum.photos/seed/trail5/400/440",
"https://picsum.photos/seed/trail6/400/440",
];
const variants: { type: VariantType; label: string }[] = [
{ type: "type1", label: "Fade & Scale" },
{ type: "type2", label: "Brightness" },
{ type: "type3", label: "Float-up" },
{ type: "type4", label: "Momentum" },
{ type: "type5", label: "Rotation" },
{ type: "type6", label: "Speed-reactive" },
{ type: "type7", label: "Stacking" },
{ type: "type8", label: "3D Perspective" },
{ type: "pixelated", label: "Pixelated" },
{ type: "scale", label: "Scale" },
{ type: "fall", label: "Image fall" },
{ type: "gravity", label: "Gravity" },
{ type: "flame", label: "Flame" },
{ type: "venetian", label: "Venetian" },
{ type: "curtain", label: "Curtain" },
{ type: "hexagon", label: "Hexagon" },
{ type: "liquid", label: "Liquid" },
{ type: "zoom-split", label: "Zoom split" },
];
let selectedVariant: VariantType = $state("type1");
</script>
<div class="mb-4 flex flex-wrap gap-2">
{#each variants as v}
<button
class="rounded-lg border px-3 py-1.5 text-sm transition-colors {selectedVariant === v.type
? 'border-primary bg-primary text-primary-foreground'
: 'border-border bg-card hover:bg-accent'}"
onclick={() => (selectedVariant = v.type)}
>
{v.label}
</button>
{/each}
</div>
<div class="relative h-[400px] cursor-crosshair overflow-hidden rounded-lg border">
<ImageTrailCursor {images} variant={selectedVariant} />
<div class="pointer-events-none absolute inset-0 flex items-center justify-center">
<p class="text-muted-foreground/50 text-lg select-none">Move your cursor here</p>
</div>
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
images | string[] | [] | Array of image URLs to show in the trail |
variant | "type1" | ... | "type8" | "pixelated" | "scale" | "fall" | "gravity" | "flame" | "venetian" | "curtain" | "hexagon" | "liquid" | "zoom-split" | "type1" | Animation variant controlling how images appear and move (see the README for what each one does) |
class | string | "" | Additional CSS classes for the container |
Links
Related components
AnimatedBeam
Fibre-optic connector between two elements: a light packet with a dispersing chromatic tail runs along a glass fibre and blooms behind the destination on arrival; theme-aware, seeded and still under reduced motion.
BorderBeam
A single comet of light riding a container's border: a white-hot head, a long feathered tail fading between two colours, a dim hairline that lights up only within the comet's reach, and a soft bloom that sits on the edge.
Confetti
Confetti celebration effect powered by canvas-confetti with button trigger support