Infinite Drift

Horizontal image strips with parabolic curvature and optional tilt, driven by wheel, page scroll, and drag inertia. Pure Canvas 2D - no Three.js. Bundled photos install under components/3d/infinite-drift/images.

Default

Drag vertically or scroll the page - five curved bands drift with inertia. Demo photos ship with the install.

Loading…

Installation

CLI
npx @sonojs/ui@latest add infinite-drift

Usage

page.tsx
"use client"

import { InfiniteDrift } from "@/components/3d/infinite-drift"

export default function Page() {
  return (
    <InfiniteDrift
      height={600}
      bands={[
        {
          speed: 1,
          rotation: 7,
          curveAmount: 40,
          images: ["/media/a.jpg", "/media/b.jpg", "/media/c.jpg"],
        },
        {
          speed: 1.3,
          offsetY: -100,
          images: ["/media/d.jpg", "/media/e.jpg"],
        },
      ]}
    />
  )
}

Props

PropTypeDefaultDescription
bandsInfiniteDriftBand[]bundled demoPer-band images, speed, offsetY, rotation, curveAmount, curveDirection, rotationType.
heightstring · number600Stage height.
gapnumber20Gap between images in a band (px).
imageHeightnumber100Drawn image height in the strip.
bandHeightnumber120Band strip canvas height.
maxImageWidthnumber300Cap width when preserving ratios.
inertianumber0.92Velocity decay each frame.
preserveOriginalRatiosbooleantrueKeep source aspect ratios when sizing tiles.
classNamestring-Classes on the stage.
childrenReactNode-Optional overlay content above the canvas.