Cursor ImageTrail

mouse trail component with animated image effects on hover.

Hover me

Mouse move image 0Mouse move image 1Mouse move image 2Mouse move image 3Mouse move image 4Mouse move image 5Mouse move image 6Mouse move image 7Mouse move image 8Mouse move image 9Mouse move image 10Mouse move image 11Mouse move image 12Mouse move image 13Mouse move image 14Mouse move image 15

Installation

npx scrollx-ui@latest add cursorimagetrail

Usage

import CursorImageTrail from "@/components/ui/cursorimagetrail";
<CursorImageTrail
      renderImageBuffer={50}
      rotationRange={25}
      animationStyle="dynamic" 
      images={Array.from({ length: 16 }, (_, i) => `/images/active/${i + 1}.jpg`)}
    >
      <section className="grid h-screen w-full place-content-center bg-white text-black dark:bg-black dark:text-neutral-200 antialiased">
        <p className="flex items-center gap-2 text-5xl font-extrabold uppercase tracking-wide transition-colors duration-500">
          <MousePointer className="w-10 h-10" />
          <span>Hover me</span>
        </p>
      </section>
    </CursorImageTrail>

API Reference

CursorImageTrail

The CursorImageTrail component creates an interactive mouse trail effect with animated images. It tracks mouse movement and renders images along the cursor path with configurable animation styles.

Props

  • children (ReactNode, required)
    Content that triggers the image trail effect when hovered.

  • images (string[], required)
    Array of image paths to use in the trail.

  • renderImageBuffer (number, required)
    Minimum pixel distance between consecutive image renders (controls trail density).

  • rotationRange (number, required)
    Maximum rotation angle (in degrees) applied to images.

  • animationStyle ("dynamic" | "minimal", default: "dynamic")
    Animation variant:

    • "dynamic": Complex animations .
    • "minimal": Simpler animations without complex transforms.