React Liquid Chrome Background
React liquid chrome background with WebGL rendering. Features fluid metallic effects, interactive ripples, and customizable wave patterns with anti-aliased supersampling.
Creating liquid metallic effects?
Join our Discord community for help from other developers working with shader effects and WebGL.
Ever watched liquid metal flow and ripple, creating those mesmerizing patterns that seem to shift between dimensions? The way chrome surfaces bend light and reality, creating infinite reflections and fluid distortions that make you question what's real? Most backgrounds are flat, predictable textures that lack the organic fluidity of liquid metal. This React component recreates that hypnotic liquid chrome effect with WebGL shaders, mathematical wave functions, and interactive ripples that respond to touch and movement.
Interactive liquid chrome with touch ripples
Watch metallic patterns flow and respond to mouse movement with realistic liquid physics:
Built for React applications with TypeScript and Next.js. Uses WebGL through OGL for hardware-accelerated shader rendering with anti-aliased supersampling for ultra-smooth edges. Advanced mathematical wave functions create authentic liquid flow while interactive ripple effects add responsive touch feedback. Perfect for futuristic interfaces, product showcases, or any design needing that premium metallic aesthetic.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/liquid-chrome-background.json
npx shadcn@latest add https://www.shadcn.io/registry/liquid-chrome-background.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/liquid-chrome-background.json
bunx shadcn@latest add https://www.shadcn.io/registry/liquid-chrome-background.json
Why static chrome textures feel dead
Developers use CSS gradients with metallic colors and call it chrome. Maybe they add a simple animation that slides predictably. The problem? Static textures can't capture the organic flow and infinite complexity of liquid metal that makes surfaces feel alive and responsive.
Liquid chrome backgrounds with shader mathematics change everything. They tap into our fascination with fluid dynamics—the way liquid metal moves in unpredictable but mathematically beautiful patterns, how chrome surfaces create infinite reflections and distortions. The shader calculations use trigonometric wave functions and iterative feedback loops to generate true liquid physics.
This component handles complex WebGL mathematics automatically. Wave generation, anti-aliased supersampling, ripple propagation, and touch interaction all work together seamlessly. The result feels like touching real liquid chrome, not a simple animated texture.
Features
- Mathematical wave generation with trigonometric functions for authentic liquid flow patterns
- Anti-aliased supersampling with 3x3 sample grid for ultra-smooth visual quality
- Interactive ripple effects with exponential falloff and sine wave propagation
- Touch and mouse support with normalized coordinate handling for all devices
- Customizable base colors supporting RGB triplets for metallic tinting
- Frequency controls for independent X and Y axis wave patterns
- Speed and amplitude controls for fine-tuning liquid characteristics
- Performance optimization with efficient WebGL rendering and proper cleanup
- TypeScript support with complete prop forwarding and type safety
- Responsive design with automatic canvas resizing and aspect ratio handling
API Reference
LiquidChromeBackground
Prop | Type | Default | Description |
---|---|---|---|
baseColor | [number, number, number] | [0.1, 0.1, 0.1] | RGB color triplet (0-1 range) for metallic base |
speed | number | 0.2 | Animation speed multiplier (0.1 to 2.0) |
amplitude | number | 0.5 | Wave amplitude strength (0.1 to 2.0) |
frequencyX | number | 3 | Horizontal wave frequency (1 to 10) |
frequencyY | number | 2 | Vertical wave frequency (1 to 10) |
interactive | boolean | true | Enable touch/mouse ripple effects |
className | string | - | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
Color Palettes
Metallic color combinations for different chrome effects:
Style | BaseColor | Visual Result | Use Case |
---|---|---|---|
Classic Chrome | [0.1, 0.1, 0.1] | Traditional metallic silver | Premium product displays |
Gold Chrome | [0.3, 0.2, 0.05] | Warm golden metal | Luxury branding |
Blue Steel | [0.05, 0.1, 0.2] | Cool blue metallic | Tech interfaces |
Rose Gold | [0.25, 0.15, 0.1] | Warm pink metal | Fashion/beauty |
Wave Patterns
Different frequency combinations create distinct liquid behaviors:
FrequencyX | FrequencyY | Pattern | Visual Characteristic |
---|---|---|---|
2 | 2 | Uniform waves | Smooth, regular flow |
4 | 2 | Horizontal stretch | Wide, flowing ribbons |
2 | 5 | Vertical ripples | Narrow, rapid oscillations |
6 | 8 | Complex turbulence | Chaotic, organic movement |
Effect Configurations
// Classic liquid chrome
<LiquidChromeBackground
baseColor={[0.12, 0.12, 0.15]}
speed={0.25}
amplitude={0.6}
frequencyX={3}
frequencyY={3}
interactive={true}
/>
// High-energy metallic waves
<LiquidChromeBackground
baseColor={[0.2, 0.1, 0.3]}
speed={0.8}
amplitude={1.2}
frequencyX={5}
frequencyY={4}
interactive={true}
/>
// Subtle ambient liquid
<LiquidChromeBackground
baseColor={[0.05, 0.08, 0.1]}
speed={0.1}
amplitude={0.3}
frequencyX={2}
frequencyY={2}
interactive={false}
/>
// Golden liquid metal
<LiquidChromeBackground
baseColor={[0.35, 0.25, 0.1]}
speed={0.4}
amplitude={0.8}
frequencyX={4}
frequencyY={3}
interactive={true}
/>
Shader mathematics
Wave Function Iteration: Uses nested loops with trigonometric functions to build wave complexity through iterative addition, creating organic liquid flow patterns.
Anti-Aliased Supersampling: Implements 3x3 sample grid with averaged color calculation, eliminating jagged edges and creating ultra-smooth visual quality.
Ripple Propagation: Calculates distance-based exponential falloff with sine wave modulation for realistic touch ripple effects that decay naturally.
Color Division Algorithm: Uses mathematical division by sine functions to create the characteristic liquid chrome intensity variations and highlights.
Performance considerations
Supersampling Cost: The 3x3 anti-aliasing grid requires 9 shader samples per pixel. Consider reducing complexity on lower-end devices for better performance.
Iteration Loops: Fragment shader uses loops up to 10 iterations for wave calculation. High frequency values increase computational overhead significantly.
Mouse Interaction Impact: Interactive ripples add distance calculations and sine operations per pixel. Disable for static backgrounds to optimize performance.
Canvas Resolution: Component uses 1x scale by default. Higher scale values improve quality but dramatically impact performance on high-DPI displays.
Common gotchas
Color Range: Base colors use 0-1 RGB values, not 0-255. Values outside this range may cause unexpected visual artifacts or shader errors.
Frequency Limits: Very high frequency values (greater than 10) can create aliasing artifacts and may impact performance. Keep within recommended ranges.
Touch Event Handling: Component handles both mouse and touch events. On hybrid devices, both may fire simultaneously, potentially causing double ripple effects.
Canvas Context Loss: WebGL context can be lost during GPU driver updates. Component handles cleanup but may show blank content briefly during restoration.
Amplitude Clipping: Very high amplitude values can cause wave patterns to clip or wrap unexpectedly. Test with different screen sizes and aspect ratios.
You might also like
Plasma Background
Organic plasma effects with WebGL shaders
Silk Background
Flowing fabric textures with wave distortion
Light Waves
Animated light beams with noise distortion
Balatro Background
Psychedelic spiral patterns with mouse control
Questions developers actually ask
React Lightning Background
React lightning background with WebGL. Features fractal noise, HSV color space, and dynamic electric patterns with customizable intensity.
React Meteors Background
React meteor background with shooting star animations. CSS gradients and randomized timing create cosmic effects with TypeScript and shadcn/ui.