tween
ComponentsTemplatesShowcaseContact

Command Palette

Search for a command to run...

Getting Started
  • Introduction
  • Installation
  • StoryNew
Guides
  • Motion Principles
  • Scroll and Smooth Scroll
  • Performance and Accessibility
Scroll Animations
  • Sticky Cards Scroll
  • Rise Fan Cards Scroll
  • Rotate Stack Scroll
  • Doodle Lens ScrollNew
  • Slit Open Hero ScrollNew
  • Logo Mask Zoom ScrollNew
  • ASCII Dissolve ScrollNew
  • Lottie Flight ScrollNew
  • Inline Icon Text ScrollNew
  • Starfield ScrollNew
  • Name Swap ScrollNew
  • Spotlight Gallery HeroNew
  • Slit Rotate Hero ScrollNew
  • Stroke Cover ScrollNew
  • Stroke Rows ScrollNew
Text Animations
  • Text Skew Reveal
  • Block Text Reveal
Hover & Cursor
  • Image Trail Cursor
  • Cursor Depth Logo
  • Physics Tag Drop
  • Elastic Card ListNew
  • Magnetic Cards SpringNew
Sliders & Carousels
  • Wheel Fullscreen Carousel
  • Ripple Displacement Slider
  • Three.js Blend Slider
  • Stacked Deck Slider
  • Orbit Cylinder SliderNew
  • Fan Stack SliderNew
  • Exponential Strip SliderNew
  • Dual Column SliderNew
Galleries & Grids
  • Scroll Wave Gallery
Menus & Navigation
  • Shrink Page MenuNew
Preloaders & Intros
  • Floating Items RevealNew
  • Word Cycle RevealNew
  • Tile Grid LoaderNew
Page Transitions
  • Panel Assembly TransitionNew
3D & WebGL
  • Fractal Glass Hero
  • Fluid Cursor Canvas
  • Fluid Portrait Hero
  • Fluid Gradient Canvas
  • Inversion Lens HoverNew
UI Elements
  • Circular Widgets
  • Vinyl Cover
  • Image Explosion Footer
  • Accordion Image FramesNew

(Tween) — Motion registry

Animated components & full sites, one command away.

Product

  • Components
  • Templates
  • Installation
  • Guides
  • Blog
  • Contact

Categories

  • Scroll Animations
  • Text Animations
  • Hover & Cursor
  • Sliders & Carousels
  • Galleries & Grids
  • Menus & Navigation
  • Preloaders & Intros
  • Page Transitions
  • 3D & WebGL
  • UI Elements
TWEEN
ease: power2.inOut0.00s
© 2026 TweenBack to topBuilt by mohammad
  1. Docs/
  2. Components/
  3. Image Trail Cursor

Image Trail Cursor

PreviousNext

A cursor-following image trail that spawns and fades randomized images as the pointer moves across the container.

Open in
image-trail-cursor-demo

Costa Velluto · Summer Log 26

Trace the coastline.

components/ui/image-trail-cursor-demo.tsx
import { ImageTrailCursor } from "@/registry/tween/image-trail-cursor"

export function ImageTrailCursorDemo() {
  return (
    <ImageTrailCursor
      className="flex items-center justify-center bg-[#f6f2ea] text-[#1e1e1e]"
      style={{ height: "var(--preview-h, 100vh)" }}
    >
      <div className="px-6 text-center select-none">
        <p className="mb-4 font-mono text-[0.7rem] tracking-[0.2em] text-[#1e1e1e]/60 uppercase">
          Costa Velluto &middot; Summer Log 26
        </p>
        <h1 className="text-[clamp(2rem,5cqi,4rem)] leading-[0.95] font-medium tracking-tight">
          Trace the coastline.
        </h1>
      </div>
    </ImageTrailCursor>
  )
}

Installation

pnpm dlx shadcn@latest add https://tweenui.dev/r/image-trail-cursor.json

Usage

import { ImageTrailCursor } from "@/components/ui/image-trail-cursor"
<ImageTrailCursor
  className="flex h-[600px] items-center justify-center bg-white"
  images={["/coast/cove.jpg", "/coast/cliff.jpg", "/coast/swim.jpg"]}
>
  <h1>Trace the coastline.</h1>
</ImageTrailCursor>

As the pointer moves across the container, the component samples its travel distance and spawns a new image from the images array once it exceeds mouseThreshold. Each spawned image scales in, holds at full size for imageLifespan milliseconds, then scales back out and is removed, producing a continuous trail that follows the cursor. While the pointer sits idle inside the container, images keep spawning on idleInterval so the effect never freezes, and scroll movement is throttled by scrollThreshold so the trail stays smooth during fast scrolling. Children render above the trail layer, so headings and links stay fully interactive.

Props

PropTypeDefaultDescription
imagesstring[]20 remote photosImage URLs to randomise from.
imageLifespannumber750How long each trail image stays at full scale (ms).
mouseThresholdnumber100Minimum pointer travel before a new image is spawned (px).
idleIntervalnumber300Spawn interval while the pointer is idle inside the container (ms).
scrollThresholdnumber50Minimum delay between scroll-triggered spawns (ms).
imageSizenumber200Width/height of each trail image (px).
inDurationnumber750Scale-in transition duration (ms).
outDurationnumber1000Scale-out transition duration (ms).
inEasingstringcubic-bezierCSS easing for scale-in.
outEasingstringcubic-bezierCSS easing for scale-out.
scrollerHTMLElement | string | null—Optional scroll target; defaults to the ambient preview scroller.
childrenReactNode—Content rendered inside the wrapped area (sits above the trail layer).
classNamestring—Extra classes on the outer container.
Block Text RevealCursor Depth Logo

On This Page

InstallationUsageProps

Contribute

  • Report an issue
  • Request a feature
  • Edit this page