Animated React backgrounds and shaders

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. Scroll inside the card.

Backgrounds, scroll, Motion

Install

npm i clsx motion tailwind-merge && curl -o components/pixel-scroll.tsx https://motion-brew.com/r/pixel-scroll.tsx

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

Usage

import { PixelScroll } from "@/components/pixel-scroll";

export default function Page() {
  return (
    <PixelScroll
      mode="layers"
      layerA="/before.jpg"
      layerB="/after.jpg"
      direction="center-out"
      pattern="spiral"
      length={3}
      label="The studio, before and after"
    >
      <h2 className="grid h-full place-items-center text-6xl font-semibold text-white mix-blend-difference">
        Keep scrolling
      </h2>
    </PixelScroll>
  );
}

Props

PropTypeDefaultDescription
mode"colors" \"layers""colors"Color to color, or image to image
fromstring"#f5f5f5"Start color (colors mode)
tostring"#242423"End color (colors mode)
layerAstringStart image (layers mode)
layerBstringEnd image (layers mode)
pixelSizenumber16Pixel size, px
gapnumber0Gap between pixels along the moving front, px
startAtnumber0.08How much already shows before scrolling, 0 to 0.5
endAtnumber0.8How far through the scroll the transition finishes, 0.1 to 1
direction"top-bottom" \"bottom-top" \"left-right" \"right-left" \"center-out" \"center-in""bottom-top"Where the flip starts
pattern"random" \"checker" \"diagonal" \"wave" \"spiral" \"radial""random"How the front is broken up
intensitynumber0.45How strongly the pattern shifts timing, 0 to 1
easing"linear" \"ease-in" \"ease-out" \"ease-in-out" \"expo-out""ease-in-out"Timing curve
accentSharenumber0.25Share of moving pixels that flash an accent, 0 to 1
accentsstring[]four colorsUp to four accent colors
lengthnumber3Scroll length in screens (or container heights)
containerRefObject<HTMLElement>Scroll inside this element instead of the page
childrenReactNodeContent laid over the stage
labelstringDescribes the visual for screen readers
classNamestringClasses on the track

More backgrounds

  • Magnetic flow: Cards follow the leader like a snake, then burst open like the sun.
  • Gravity tag pile: Tags fall, bounce, spin and pile up with real physics.
  • Prism flow: A dark background crossed by a soft band of light that bends and drifts, its edges splitting into colour like light through a prism.
  • 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.

All animated react backgrounds and shaders