Skip to documentation content

Warp

Domain-warped fractal noise mapped to a color palette, as soft clouds, ridges, or marble.

warp-demo

Overview

Warp layers fractal noise and then feeds the noise back into its own input, twice. The result folds into flowing, smoke-like shapes that move slowly over time. Each value maps onto colors, from the first color at the lowest value to the last at the highest.

Three patterns change the character of the field:

  • fbm gives soft, cloud-like gradients.
  • Ridged folds each noise layer into sharp creases, like terrain or veins.
  • Marble bends diagonal bands through the warped field.

Use it for textured backgrounds, artwork panels, and loading surfaces. Ordered palettes, dark to light, give the clearest depth.

Installation

npm install honestui

Usage

import { Warp } from "honestui/shaders"

<div className="h-80 bg-[#2c3552]">
  <Warp
    className="size-full"
    colors={["#14161f", "#2c3552", "#6f7fa8", "#d9c8b4", "#f6efe6"]}
    pattern="fbm"
    warp={1}
  />
</div>

Each octave adds a layer of noise per warp pass, so lower octaves on large surfaces or low-power devices.

Accessibility

Warp is decorative and its canvas is hidden from assistive technology. Keep content in normal HTML; the field spans the full palette, so place text on a solid panel or check contrast against both ends of it.

The effect pauses while it is offscreen or the tab is hidden, and shows a still frame when the user prefers reduced motion. Without WebGL2 the container shows only its own background.

API Reference

PropTypeDefaultDescription
colorsstring[]["#14161f", "#2c3552", "#6f7fa8", "#d9c8b4", "#f6efe6"]Two to six hex colors from the lowest to the highest value.
patternfbm|ridged|marble"fbm"Character of the noise.
scalenumber1Feature size. Higher values zoom out.
octavesnumber5Layers of detail, from 1 to 8.
warpnumber1How strongly the noise folds back on itself, from 0 to 2.
swirlnumber0.3Rotation between warp passes, from 0 to 1.
contrastnumber1.2Separation between the darkest and lightest colors.
speednumber0.4Animation speed.
pausedbooleanfalseRenders a still frame instead of animating.
classNamestring–Class for sizing and positioning the container.