Animated React backgrounds and shaders

Spatial gallery

A WebGL media tunnel of images and videos that never ends: scroll or drag to travel, and the ring twists into a turning spiral as you go. Videos load only when hovered. Built for portfolios, showreels and studio pages.

Backgrounds, scroll, drag and hover, Motion + GSAP

Install

npm i clsx gsap motion tailwind-merge && curl -o components/spatial-gallery.tsx https://motion-brew.com/r/spatial-gallery.tsx

One self contained file for React and Tailwind CSS: spatial-gallery.tsx. Or ask your AI agent to add it through the MCP server.

Usage

import { SpatialGallery } from "@/components/spatial-gallery";

export default function Work() {
  return (
    <SpatialGallery
      className="h-dvh"
      items={[
        { src: "/work/one.jpg", alt: "Brand film for Lumen", href: "/work/lumen" },
        { src: "/work/reel.mp4", type: "video", poster: "/work/reel.jpg", alt: "2026 reel" },
      ]}
    >
      <h1 className="absolute inset-0 grid place-items-center text-[48px] font-semibold">Selected work</h1>
    </SpatialGallery>
  );
}

Props

PropTypeDefaultDescription
itemsSpatialItem[]14 samplessrc, type (image or video), poster, alt, href
countnumber124Planes in the tunnel, 8 to 160
radiusnumber4.1Tunnel radius
corenumber0.8Hollow core, 0 to 0.95
spacingnumber0.2Depth between planes
sizenumber0.95Plane size
rollnumber0Each plane's own tilt, 0 to 1
facing"front" \"funnel""funnel"
funnelnumber0.78How far Funnel leans into the wall, 0 to 1
spiralbooleantrueCorkscrew that turns as it travels
twistnumber0.3Corkscrew strength, 0 to 1
autoMovebooleantrueDrift on its own, on top of input
speednumber0.8Auto move speed; negative goes backward
scrollSpeednumber2.1How far the wheel or page scroll carries you
captureScrollbooleantrueScrolling over it travels instead of scrolling the page
followPageScrollbooleantrueTravel as the page scrolls past
dragbooleantrueDrag to travel
parallaxnumber0.5Lean with the pointer, 0 to 1
cornernumber0.22Corner radius as a share of the plane height
fognumber0.8Fade out with distance (to transparent)
captionbooleantrueName the hovered item
linkTarget"_self" \"_blank""_self"
childrenReactNodeAnything on top, like a heading
classNamestringSize it; default height 560px

More backgrounds

  • Pixel blast: A background of dithered pixel clouds that drift, shimmer and light up under the cursor.
  • Contour lines: A background of live topographic lines that bend around the cursor.
  • Pixel scroll: A scroll-driven pixel transition from one color or image to another, with directions, patterns, easings and accent pixels in the moving band.
  • Magnetic flow: Cards follow the leader like a snake, then burst open like the sun.

All animated react backgrounds and shaders