Background

Bubble

Slow gradient blobs that float and turn behind the content.

bubble.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/bubble.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/bubble.json

3

Turn on the motion

npx @prequelui/cli@latest animate bubble

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

bubble.tsx
import { BubbleBackground } from "@/components/prequelui/backgrounds/bubble";

export default function Demo() {
  return (
    <div className="relative h-96 overflow-hidden rounded-xl">
      <BubbleBackground interactive />
    </div>
  );
}
import { Bubble } from "@/components/prequelui/bubble";

export function Variant() {
  return (
    <Bubble tempo={1.2}>
      …
    </Bubble>
  );
}

Animation

Six coloured blobs share one soft-material filter. Five drift and rotate on long loops; the sixth only appears when the pointer is inside the container and follows it on a 100 / 20 spring, so the scene responds without turning into a cursor toy.

  • Loops run from 20 s to 40 s depending on the blob; speed divides every duration.
  • The goo filter blurs the source by 16 px and blends it back with the original.
  • Pointer tracking is sampled once per animation frame and cached, never per move.
  • Reduced motion freezes the blobs at distinct angles and hides the pointer blob.
20–40 s loopsgoo filterpointer spring 100 / 20pause off-screen

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

BubbleBackground

PropTypeDefault
interactivebooleanfalse
colorsBubbleColorsviolet / amber / teal
transitionTransitioncomponent spring
speednumber1
pausedbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026