Mesh Gradient

Dynamic WebGL mesh gradient shader background featuring fluid swirls, configurable color stops, distortion turbulence, and film grain overlay.

3.1 KB
•
Updated on September 29, 2026
Active on Canvas Stage

Installation

Bash
pnpm dlx shadcn@latest add @spaceui/components-shader-mesh-gradient

Depends on @paper-design/shaders-react. WebGL required.

Usage

Code
import { MeshGradient } from '@/components/shader/mesh-gradient'

export default function SpaceUI() {
  return (
    <div className="relative h-96 w-full overflow-hidden rounded-2xl">
      <MeshGradient
        colors={['#085b96', '#51a0f6', '#cfe5f2']}
        speed={1}
        distortion={1}
        swirl={0.57}
        rotation={120}
        grain={true}
      />
    </div>
  )
}

API Reference

PropTypeDefaultDescription
colors
string[]
['#085b96', '#51a0f6', '#cfe5f2']Array of color stops for the gradient
speed
number
1Time progression multiplier for animation
distortion
number
1Turbulence wave amplitude
swirl
number
0.57Rotational vortex intensity
swirlIterations
number
7.4Depth of swirl fractal iterations
softness
number
1Blur and color blend smoothness
proportion
number
0Center color distribution bias
shape
edge|wave|circle
edgePrimary gradient geometry type
shapeScale
number
0.59Geometric scale factor
scale
number
1.45Global mesh magnification
rotation
number
120Initial angular orientation in degrees
grain
boolean
trueOrganic film grain overlay texture
className
string
—Wrapper CSS class name
style
React.CSSProperties
—Inline style object

Keep in mind

  • MIT License: Free and open-source for personal and commercial use. Feel free to copy, tweak, and adapt the components to match your exact needs.
  • Credits & Inspiration: Some components on this site are inspired by or recreated from great ideas across the web. I'm not here to take credit; just to learn, experiment, and push interface craft further.
  • Reach out & Claims: If an attribution was missed, or if you have any inquiry or claim, feel free to reach out directly on X to @adrielzimbril. I'll be glad to update or resolve it right away.

Related Components

CloudShader

Interactive volumetric cloud material rendered as a full-bleed shader surface.

View
Fluid CrossfadeShader

A dual-pass WebGL shader fluid simulation with chromatic wave refraction and Bayer 4x4 matrix ordered dither crossfading.

View
Fluid Distortion ImageShader

An interactive WebGL shader image component with cover UV mapping and dynamic cursor fluid-distortion ripples using data textures.

View
Liquid Mask Crossfade
pnpm dlx shadcn@latest add @spaceui/components-spaceui-ui
pnpm dlx shadcn@latest add @spaceui/components-shader-mesh-gradient