Skip to content

Noise Field

Add a topographic background with contour lines and accent-tinted peaks.

import { NoiseField } from '@youj/motion/backgrounds'

Experimental: what this label means

Installation & usage

npm i @youj/motion

For an app already set up with npx @youj/cli init, which installs the peers (@youj/core, @youj/motion, motion and Base UI) and wires the provider. New app? Start at Installation.

Use it behind technical products: networks, infrastructure, maps and data. The precise hairlines there read as measurement, not decoration. It suits heroes and section backdrops with short copy. Don't put it behind long text or dense UI, because the lines compete with small type. Reach for Mesh Gradient when you want color without line work.

The field fills its nearest positioned ancestor and paints behind your content, so make the container relative and isolate.

import { NoiseField } from '@youj/motion/backgrounds'

export function NetworkHero() {
  return (
    <section className="relative isolate min-h-[560px]">
      <NoiseField />
      <p className="relative text-5xl font-semibold">Route every request along the shortest path</p>
    </section>
  )
}

Terrain drifts slowly through a domain-warped noise, so ridges flow into new shapes instead of sliding across the screen. Every fifth contour is an index line, drawn heavier. The summits pick up the accent, and a vignette keeps the edges quiet so the field frames the content instead of competing with it.

Keep a quiet zone behind the copy. In the preview, a gradient from canvas to transparent sits between the field and the text.

Reference

Propscolors, intensity, speed… (6)

Props

NoiseField props
PropType
colors[lines: string, summit: string]

[lines, summit] CSS colors. Default: --color-fg lines, --color-accent summits.

–
intensitynumber

Line and tint strength, 0–1.5.

default 1

1
speednumber

Flow speed multiplier.

default 1

1
densitynumber

Number of contour intervals across the height range.

default 14

14
interactiveboolean

The pointer raises a mound that bunches the contours around it.

default true

true
classNamestring–
PerformanceIt's one WebGL2 fragment shader on a single full-screen triangle,…

Performance

It's one WebGL2 fragment shader on a single full-screen triangle, rendered at a device-pixel ratio capped at 2. Contour lines are anti-aliased from screen-space derivatives, so they stay one device pixel wide at any size. The loop pauses when the field is offscreen or the tab is hidden, recovers from a lost GL context, and releases the context on unmount. Without WebGL2, it falls back to a static CSS wash of the summit color over the canvas.

MotionFlow, pointer mound · reduced motion

Motion

Motion tokens
MomentTokens
Flowcontinuous shader clock
no token

speed ÷ time scale

speed ÷ time scale
Pointer moundfollows the pointer, fades in and out
no token

smoothed per frame

smoothed per frame

Reduced motion

Draws one still map and stops. There's no flow and no pointer mound, and the map redraws only when the size, the props or the theme change.

Reduced motion

The field draws one composed map and holds it. Nothing flows and the pointer raises no mound, but the survey, its colors and its framing stay the same, so the page looks as intended without motion. Switch on Reduced motion in any preview above to compare.

AccessibilityARIA, focus

Accessibility

  • It's decorative: the element is aria-hidden and ignores pointer events, so it never takes focus or clicks from the content above it.
  • Check your text's contrast over the densest part of the survey. A quiet zone behind the copy, or a lower intensity, keeps small type readable.
  • The flow is slow, and it stops when the field is offscreen. Under reduced motion the field doesn't move at all.