Animation

Waves

Wave-field background — a grid of lines drifting on perlin noise, nudged by the pointer. Line colour follows the theme out of the box. Use behind hero copy or section content.

Angular adaptation of an effect by David Haz / reactbits.dev.

Import

import { WrWaves } from 'ngwr/waves';

Playground

Content above the waves

<section style="position: relative">
  <wr-waves [waveAmpX]="32" [waveAmpY]="16" [xGap]="10" [yGap]="32" />
  <h1>Content above the waves</h1>
</section>

Customize

Amp X
32
Amp Y
16
X Gap
10
Y Gap
32

API

NameDescriptionTypeDefault
lineColorLine stroke colour. Unset, the theme decides: a dark tint on light, white-alpha on dark.string | nullnull
backgroundColorFill behind the lines.string'transparent'
waveSpeedXHorizontal noise drift per ms.number0.0125
waveSpeedYVertical noise drift per ms.number0.005
waveAmpXHorizontal wave amplitude (px).number32
waveAmpYVertical wave amplitude (px).number16
xGapGap between lines (px).number10
yGapGap between points on a line (px).number32
frictionCursor-spring damping, 0..1.number0.925
tensionCursor-spring pull-back strength.number0.005
maxCursorMoveMax px a point drags from rest.number100

CSS variables

Custom properties ngwr/waves publishes. Each default below is declared on the component's own selector, so a :root override is shadowed by it — set them on that selector, on a wrapper you scope yourself, or inline on the element. Unlike the BEM class names, these are the supported way to restyle the component.

VariableDefaultDeclared on
--wr-waves-line-colorrgba(var(--wr-color-on-surface-rgb), 0.12).wr-waves +1 variant override
--wr-waves-x-gap10px.wr-waves