Infinite Parallax Gallery

A stunning WebGL-powered parallax gallery utilizing three.js. It features hardware-accelerated rendering, an infinite scrolling loop, layered depth parallax, and seamless drag/scroll interactions.

Loading 0%

Installation


npx shadcn-extras@latest add infinite-parallax-gallery

[!NOTE] This component requires the three and @types/three packages which will be automatically installed by the CLI.

Props

The InfiniteParallaxGallery component accepts the following props:

PropTypeDefaultDescription
imagesstring[]RequiredArray of image URLs to load in the gallery.
depthLayersnumber5Number of Z-index depth layers for the parallax effect.
imagesPerLayernumber10Number of image sprites to instantiate per layer.
maxImageWidthnumber160Maximum width of an image sprite.
maxImageHeightnumber160Maximum height of an image sprite.
overlayTextReact.ReactNodeundefinedOptional overlay to display on top of the gallery (e.g., attribution text).
showLoadingbooleantrueWhether to show the percentage loading indicator while textures are being cached.

Variants

Dense Parallax

You can increase the depthLayers and imagesPerLayer while decreasing the image sizes to create a super dense, fast-moving gallery.

Loading 0%

Minimal & Large

By dramatically lowering the layers and increasing the maxImageWidth, you can achieve a totally different slow-moving, portfolio-style look.

Loading 0%

Features

  • WebGL Rendering: Uses three.js to render dozens of layered images at a smooth 60FPS.
  • Interactive Physics: Responds naturally to mouse drag, touch swipes, and scroll wheels with momentum and deceleration.
  • Resource Management: Automatically handles WebGL context creation and disposal to prevent memory leaks in React.
  • Fallback Loading: Generates placeholder canvases while images download.