Background

Waves

Interactive wave animations with cursor-following physics and Perlin noise generation. Perfect for React applications requiring fluid background effects with Next.js integration and TypeScript support.

Powered by

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/waves.json
npx shadcn@latest add https://www.shadcn.io/registry/waves.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/waves.json
bunx shadcn@latest add https://www.shadcn.io/registry/waves.json

Features

  • Interactive cursor physics with waves responding to mouse movement using realistic spring dynamics
  • Perlin noise generation creating smooth, natural wave patterns with organic flow algorithms
  • Customizable wave properties controlling speed, amplitude, spacing, friction, and tension parameters
  • Canvas-based rendering using efficient HTML5 Canvas with requestAnimationFrame optimization
  • Touch-friendly interaction supporting both desktop mouse and mobile touch events
  • Theme-aware styling automatically adapting to light/dark themes using CSS custom properties
  • Performance optimized maintaining smooth 60fps animation across all devices
  • TypeScript support with complete interface definitions for reliable integration

Examples

Subtle Waves

Loading component...

Use Cases

This free open source React component works well for:

  • Hero section backgrounds - Fluid wave animations for modern landing pages built with Next.js
  • Interactive portfolios - Cursor-responsive effects showcasing technical capabilities using TypeScript
  • Creative showcases - Organic animations for galleries and design presentations
  • Dashboard interfaces - Subtle background motion for admin panels using shadcn/ui design
  • Brand experiences - Fluid animations expressing innovation and creativity
  • Loading screens - Mesmerizing wave patterns during content processing using Tailwind CSS animations

API Reference

Props

PropTypeDefaultDescription
lineColorstring"hsl(var(--foreground))"Color of the wave lines
backgroundColorstring"white"Background color of the container
waveSpeedXnumber0.0125Horizontal wave animation speed
waveSpeedYnumber0.005Vertical wave animation speed
waveAmpXnumber32Horizontal wave amplitude
waveAmpYnumber16Vertical wave amplitude
xGapnumber10Horizontal spacing between wave lines
yGapnumber32Vertical spacing between wave points
frictionnumber0.925Physics friction coefficient (0-1)
tensionnumber0.005Spring tension for cursor interaction
maxCursorMovenumber100Maximum cursor influence distance
classNamestring-Additional CSS classes

Implementation Notes

  • Component uses HTML5 Canvas API with Perlin noise algorithms for natural wave generation
  • Interactive physics system responds to cursor movement with configurable spring dynamics
  • Canvas automatically adapts to container dimensions and handles window resize events
  • Wave properties customizable: speed (0.005-0.05), amplitude (8-64), spacing (5-50)
  • Physics parameters: friction (0.8-0.99), tension (0.001-0.01), cursor influence (50-200px)
  • Performance optimized using requestAnimationFrame and efficient canvas operations
  • Theme integration supports CSS custom properties for automatic light/dark adaptation
  • Compatible with shadcn/ui design system and works as absolute positioned background element
  • Touch events supported for mobile interaction with same physics as desktop mouse