Ridgelines

About this component

Ridgelines

A Canvas 2D stacked ridgeline plot in the spirit of a pulsar chart: dozens of lines lifted by slow noise gathered in a central band, each filled to hide the ridges behind it, rising from flat on mount. Nearby lines lift under the cursor. Ink and paper colors, line count, ridge height, band width, speed, line weight and the cursor peak are all props. Pauses offscreen and holds a still plot for reduced motion.

Usage

The import and the props worth knowing about, in one place.

import { Ridgelines } from "@/components/beste/component/ridgelines";

// A square cover panel
<Ridgelines className="aspect-square rounded-sm" />

<Ridgelines
  className="min-h-[32rem]"
  inkColor="var(--foreground)"    // any CSS color, tokens included
  paperColor="var(--background)"
  lines={40}                      // 12 to 96
  amplitude={0.7}                 // taller ridges
  spread={0.3}                    // a narrower central band
  weight={0.2}                    // finer lines
  riseIn={false}                  // skip the rise on mount
/>

Props

Read from the component's own type, so this cannot drift from what it accepts.

PropTypeDefaultDescription
inkColorstring—Color of the lines. Any CSS color, tokens included.
paperColorstring—Color behind the lines, also used to hide the ridges further back.
linesnumber—Number of stacked ridgelines, 12 to 96.
amplitudenumber—Height of the ridges, 0 to 1.
spreadnumber—Width of the central band where the ridges rise, 0 (narrow) to 1 (wide).
speednumber—How fast the noise travels through the ridges, 1 is the default pace.
weightnumber—Line weight, 0 (hairline) to 1 (heavy).
riseInboolean—Ridges rise from flat lines on mount.
interactiveboolean—Nearby lines lift under the cursor.
peaknumber—How high the cursor lifts the lines, 0 to 1.
pausedboolean—Freeze the plot on its current frame.
classNamestring—
childrenReactNode—

More Background components

View all Background