Parallax Image

An image that drifts slower than the page inside a masked frame.

gsap@gsap/reactMIT · free
Abstract ocean artwork
Abstract ocean artwork

Installation

npx shadcn@latest add https://ombakui.com/r/parallax-image.json

Usage

import { ParallaxImage } from "@/components/parallax-image";

<ParallaxImage src="/hero.jpg" alt="Studio" className="aspect-[4/5] rounded-xl" />

Props

PropTypeDefaultDescription
src*string–Image URL.
alt*string–Alternative text for the image.
speednumber0.15How far the image drifts inside its frame, 0–0.5.
zoombooleantrueAdd a slow zoom-out while scrolling.
loading"lazy" | "eager""lazy"Passed to the img loading attribute.
classNamestring–Classes for the frame. Set its size or aspect ratio here, e.g. "aspect-[4/5] rounded-xl".