WebGL 着色器背景

New

基于 fragment shader 的主视觉背景(极光、丝绸、等离子、光芒射线、像素爆裂(点击涟漪)、抖动噪点),单一类型化 variant 属性切换。「减少动效」偏好下渲染静态一帧;无 WebGL 时回退为同色系 CSS 渐变。

Aurora
Silk
Plasma
Light Rays
Pixel Blast
Dither

安装

用 shadcn CLI 添加,或手动复制源码。

$ bunx --bun shadcn add @uilab/webgl-background

API 参考

variant
"dither" | "aurora" | "silk" | "plasma" | "light-rays" | "pixel-blast"
className?
string
color?
string

Hex color of the dithered wave. Hex color of the light rays. Hex color of the dithered pixel field.

speed?
number

Wave animation speed. Animation speed multiplier for the ray shimmer.

pixelSize?
number

Size of each dithered pixel cell, in px. Size of each pixel cell, in px.

amplitude?
number

Wave height multiplier.

colorStops?
readonly [string, string, string]

Three hex colors sampled left-to-right across the aurora band.

blend?
number

Softness of the aurora's lower edge.

scale?
number
rotation?
number
noiseIntensity?
number
opacity?
number
spread?
number

Angular spread of the ray cone; lower is a narrower, sharper beam.

rippleIntensity?
number

Strength of the click-ripple effect.

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.