Features
- Animated metallic stripe patterns
- Chromatic aberration (RGB shift)
- Edge-aware distortion
- Multiple predefined shapes (when no image)
- Customizable color tinting
- Softness and blur controls
- Image preprocessing for optimal results
Basic Usage
Parameters
Visual Parameters
string | HTMLImageElement
default:"''"
Source image/logo to apply the liquid metal effect to. Leave empty to use predefined shapes. The image will be preprocessed automatically in React.
string
default:"'#AAAAAC'"
Background color in hex, rgb, or rgba format
string
default:"'#ffffff'"
Overlay color tint in hex, rgb, or rgba format (uses color burn blending)
number
default:"2.0"
Density of pattern stripes
number
default:"0.3"
Red channel chromatic aberration/dispersion
number
default:"0.3"
Blue channel chromatic aberration/dispersion
number
default:"0.4"
Strength of distortion on the shape edges
number
default:"0.1"
Color transition sharpness (0 = hard edge, 1 = smooth gradient)
number
default:"0.07"
Noise distortion over the stripe pattern
number
default:"70"
Direction of pattern animation in degrees
'none' | 'circle' | 'daisy' | 'diamond' | 'metaballs'
default:"'diamond'"
Predefined shape when no image is provided:
none: Fill entire canvascircle: Simple circledaisy: Flower-like shapediamond: Diamond/rhombus shapemetaballs: Animated organic blobs
boolean
default:"false"
(React only) Suspends the component when the image is being processed. Useful with React Suspense.
Sizing Parameters
'none' | 'contain' | 'cover'
default:"'contain'"
How to fit the shader into the canvas dimensions
number
default:"0.6"
Overall zoom level of the graphics
number
default:"0"
Overall rotation angle in degrees
number
default:"0"
Horizontal offset of the graphics center
number
default:"0"
Vertical offset of the graphics center
Animation Parameters
number
default:"1"
Animation speed multiplier
number
default:"0"
Manual frame control for animation
Presets
The LiquidMetal shader comes with several built-in presets:- Default: Classic liquid metal with chromatic aberration
- Noir: Black and white with high softness
- Backdrop: Full-screen canvas fill effect
- Stripes: High repetition with strong color shifts
Examples
Classic Metal
Black and White
Rainbow Stripes
Full Screen Background
Image Preprocessing
React (Automatic)
In React, image preprocessing happens automatically:suspendWhenProcessingImage to true to use React Suspense during processing.
Vanilla JavaScript (Manual)
For vanilla JavaScript, you must preprocess images manually:What Preprocessing Does
The preprocessing function:- Detects shape edges using Poisson equation
- Creates distance gradient from edges
- Optimizes for performance (512×512 working size)
- Stores gradient in red channel, alpha in green channel
Technical Details
Shader Uniforms (Vanilla JS)
When using the vanilla JavaScript API:Shape Types
none(0): Fill entire canvascircle(1): Simple circledaisy(2): Flower pattern (animated)diamond(3): Rotated diamondmetaballs(4): Animated organic blobs
Animation
The shader animates:- Flowing stripe patterns
- Metaballs movement (when using metaballs shape)
- Daisy rotation (when using daisy shape)
- Edge distortions
Chromatic Aberration
TheshiftRed and shiftBlue parameters create:
- RGB channel separation
- Rainbow edge effects
- Prism-like color dispersion
- More visible at shape edges and with higher
contour
Performance Notes
- Animated shader with continuous rendering
- Image preprocessing uses Poisson solver (~100-500ms)
- Preprocessing optimized to 512×512 working resolution
- Runtime performance is excellent after preprocessing
- Predefined shapes have no preprocessing overhead
- Best with logo/icon images rather than photos
