Skip to documentation content

Line Waves

Thin parallel lines rippling like a stacked ridgeline.

line-waves-demo

Overview

Line Waves stacks thin horizontal lines and lifts them into slow, drifting peaks that gather toward the middle and flatten at the sides. With occlude, each line hides the parts of the lines behind it, so the stack reads as a ridgeline rather than a tangle.

The background is transparent and the lines use currentColor, so the effect works in light and dark themes. With interactive, the lines swell softly under the pointer. Use it in a launch hero, an audio or signal product, or a section break.

Installation

npm install honestui

Usage

import { LineWaves } from "honestui/shaders"

<div className="relative h-96 bg-background text-foreground">
  <LineWaves className="absolute inset-0" lineCount={48} fade="edges" />
</div>

Fewer lines with a larger amplitude read as a bold ridgeline; more lines with a small amplitude give a quiet, textile-like texture.

Accessibility

Line Waves is decorative and its canvas is hidden from assistive technology. Keep text and actions in normal HTML, and place text where the peaks are low or lower opacity behind it.

The effect pauses while it is offscreen or the tab is hidden, and shows a still frame when the user prefers reduced motion. The pointer swell is a visual extra; nothing depends on it. Without WebGL the container shows only its own background.

API Reference

PropTypeDefaultDescription
lineCountnumber48Number of lines, from 4 to 120.
lineWidthnumber1Line width in CSS pixels.
amplitudenumber1Height of the peaks, from 0 (flat) to 8.
frequencynumber1How many peaks fit across the width.
colorstring"currentColor"Line color. Any CSS color.
opacitynumber0.7Line opacity, from 0 to 1.
occludebooleantrueHide the parts of each line behind the line in front, like a ridgeline.
interactivebooleantrueRaise the lines near the pointer.
fadenone|radial|edges|top|bottom"edges"Fade the lines out toward the edges.
speednumber1Animation speed. 0 holds the lines still.
pausedbooleanfalseRenders a still frame instead of animating.
classNamestring–Class for sizing and positioning the container.
childrenReactNode–Content rendered above the lines.