# 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).

- Package: `fancy-ui-react` (React 18/19 + Tailwind CSS v4)
- Category: Effects
- Tags: cursor, animation, images, trail, interactive
- Types: `ImageTrailCursorProps`, `VariantType`
- Docs: https://fancy-ui.rama.app/docs/components/image-trail-cursor
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/react/src/components/image-trail-cursor

## Import

```tsx
import { ImageTrailCursor } from 'fancy-ui-react';
```

Setup (once per project): `npm install fancy-ui-react`, then put these lines in your main CSS file (the stylesheet import goes right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-react/tailwind.css";
```

and import the component styles once in the app entry: `import "fancy-ui-react/styles.css";`. Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in React; when one differs from the Svelte name, the Svelte name follows in parentheses. `class` becomes `className`, a callback takes the name the React port declares (`onclick` becomes `onClick`), snippets become `ReactNode` props (render functions when they take arguments) and the default snippet is `children`. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/react#divergences-from-the-svelte-api

## 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) |
| `className` (Svelte `class`) | `string` | `""` | Additional CSS classes for the container |

## Example

```tsx
import { useState } from "react";
import { ImageTrailCursor, type VariantType } from "fancy-ui-react";

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",
];

const variants: { type: VariantType; label: string }[] = [
	{ type: "type1", label: "Fade & Scale" },
	{ type: "type3", label: "Float-up" },
	{ type: "type5", label: "Rotation" },
];

export function ImageTrailCursorExample() {
	const [variant, setVariant] = useState<VariantType>("type1");

	return (
		<div className="w-full">
			<div className="mb-4 flex flex-wrap gap-2">
				{variants.map((v) => (
					<button
						key={v.type}
						type="button"
						className="rounded-lg border px-3 py-1.5 text-sm"
						aria-pressed={variant === v.type}
						onClick={() => setVariant(v.type)}
					>
						{v.label}
					</button>
				))}
			</div>
			<div className="relative h-[500px] cursor-crosshair overflow-hidden rounded-lg border">
				<ImageTrailCursor images={images} variant={variant} />
				<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
					<p className="text-lg font-medium select-none">Move your cursor here</p>
				</div>
			</div>
		</div>
	);
}
```
