Join our Discord Community

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.

Powered by

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:

Loading component...

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

PropTypeDefaultDescription
baseColor[number, number, number][0.1, 0.1, 0.1]RGB color triplet (0-1 range) for metallic base
speednumber0.2Animation speed multiplier (0.1 to 2.0)
amplitudenumber0.5Wave amplitude strength (0.1 to 2.0)
frequencyXnumber3Horizontal wave frequency (1 to 10)
frequencyYnumber2Vertical wave frequency (1 to 10)
interactivebooleantrueEnable touch/mouse ripple effects
classNamestring-Additional CSS classes
...propsHTMLAttributes<HTMLDivElement>-All standard div props

Color Palettes

Metallic color combinations for different chrome effects:

StyleBaseColorVisual ResultUse Case
Classic Chrome[0.1, 0.1, 0.1]Traditional metallic silverPremium product displays
Gold Chrome[0.3, 0.2, 0.05]Warm golden metalLuxury branding
Blue Steel[0.05, 0.1, 0.2]Cool blue metallicTech interfaces
Rose Gold[0.25, 0.15, 0.1]Warm pink metalFashion/beauty

Wave Patterns

Different frequency combinations create distinct liquid behaviors:

FrequencyXFrequencyYPatternVisual Characteristic
22Uniform wavesSmooth, regular flow
42Horizontal stretchWide, flowing ribbons
25Vertical ripplesNarrow, rapid oscillations
68Complex turbulenceChaotic, 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

Questions developers actually ask