Caustics

Shimmering underwater light, like sunlight dancing on a sea floor. A tiny WebGL shader.

no dependenciesMIT · free

Under the surface.

A tiny WebGL shader, no libraries.

Installation

npx shadcn@latest add https://ombakui.com/r/caustics.json

Usage

import { Caustics } from "@/components/caustics";

<Caustics className="h-[480px]" color="#7df9ff" deep="#03243a">
  <h1>Under the surface.</h1>
</Caustics>

Props

PropTypeDefaultDescription
childrenReactNode–Content rendered on top of the light.
colorstring"#7df9ff"Color of the light patterns (hex).
deepstring"#03243a"Color of the deep water behind them (hex).
scalenumber1.6Size of the pattern; higher means smaller cells.
speednumber1Animation speed multiplier.
intensitynumber1Brightness of the light, 0–2.
interactivebooleantrueA soft glow follows the cursor.
classNamestring–