Water Ripple Effect

WebGL water ripple that distorts images with waves that follow the mouse.

Water Ripple Effect uses WebGL shaders to treat any image as the surface of a pool: moving the mouse drops ripples that refract and distort the image beneath, with waves that spread, overlap, and settle. Wave amplitude, damping, and background image are props. Built with React and Tailwind CSS. Effective for immersive hero backgrounds, image galleries that reward exploration, and section dividers with a physical feel.

Installation

Usage

import WaterRippleEffect from "@/components/ui/water-ripple-effect";
// Basic usage with default settings
<WaterRippleEffect
  imageSrc="/path/to/your/image.jpg"
  width={400}
  height={400}
/>

Props

PropTypeDefaultDescription
imageSrcstringRequiredSource URL or path to the image that will have the water ripple effect
widthnumber920Width of the canvas in pixels
heightnumber955Height of the canvas in pixels
waveIntensitynumber0.006Intensity of the global wave distortion (0-1)
rippleIntensitynumber0.012Intensity of the mouse-triggered ripple effects (0-1)
animationSpeednumber1.0Speed multiplier for all animations (0.1-5.0)
hoverRippleMultipliernumber4.0Multiplier for ripple intensity when hovering (1-10)
transitionSpeednumber0.08Speed of transitions between hover states (0.01-0.5)
waveFrequencynumber10.0Frequency of the global wave patterns (1-50)
rippleFrequencynumber20.0Frequency of the mouse-triggered ripples (5-100)
distortionAmountnumber0.008Amount of directional distortion applied to the image (0-0.1)
scalenumber1.0Scale factor for the entire component (0.1-2.0)
classNamestring""Additional CSS classes to apply to the canvas container
containerClassNamestring""Additional CSS classes to apply to the outer container
onHover() => voidOptionalCallback function triggered when mouse enters the component
onLeave() => voidOptionalCallback function triggered when mouse leaves the component