Background

Topography

Living contour lines with a hill under the pointer.

topography.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/topography.json

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

3

Turn on the motion

npx @prequelui/cli@latest animate topography

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.

topography.tsx
import { TopographyBackground } from "@/components/prequelui/backgrounds/topography";

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

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

Animation

A contour map is computed from a sum of travelling waves. Marching squares turns the field into two paths, minor lines at 30% and every fifth level at 68%; the pointer raises a hill under the cursor and a click sends a ripple through the terrain.

  • Field: four sine terms plus a Gaussian hill and decaying ripples.
  • Grid: 14 px cells, 14 levels by default, redrawn at 30 fps.
  • Pointer and hill are smoothed with exponential easing, not per-move state.
  • Reduced motion renders a static map and ignores pointer input.
14 px cellsmarching squares30 fpspointer hill + click ripple

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.

TopographyBackground

PropTypeDefault
interactivebooleantrue
levelsnumber14
scalenumber1
peaknumber1
lineColorstring | undefinedforeground
speednumber1
pausedbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026