Motion Blocks

Interaction

Image Trail

An interactive effect that spawns a trail of images following the cursor with scaling and rotation.

  • lit Preview of https://lit.devLitSimple. Fast. Web Components.
  • gsap Preview of https://gsap.comGSAPAnimate anything. Silky-smooth performance.

Preview

Move the pointer through the frame to emit an image trail with pooled GSAP animations.

Installation

pnpm dlx motion-blocks add image-trail

Usage

---import "@/components/motion-blocks/image-trail-element.ts"; const images = [  "/images/trail-1.png",  "/images/trail-2.png",  "/images/trail-3.png"]; const config = {  imageLifespan: 600,  removalTickMs: 16,  mouseThreshold: 40,  minMovementForImage: 5,  inDuration: 600,  outDuration: 800,  maxRotationFactor: 3,  baseRotation: 30,  speedSmoothingFactor: 0.25,  minImageSize: 80,  maxImageSize: 120,  staggerOut: 40};--- <motion-image-trail  images={images}  config={config}  class="w-full h-[600px]"/>

API Reference

Attribute Type Default
images Array of image URLs to cycle through in the trail. array []
config Configuration object with imageLifespan, removalTickMs, mouseThreshold, minMovementForImage, inDuration, outDuration, maxRotationFactor, baseRotation, speedSmoothingFactor, minImageSize, maxImageSize, and staggerOut options. object {}