Dissolve any React component
with WebGL
A tiny React component that wraps your UI and
dissolves it into particles using WebGL shaders.
Zero config, fully customizable.
DOCS
Installation
# npm
npm install dissolve-react
# yarn
yarn add dissolve-react
# pnpm
pnpm add dissolve-react
# bun
bun add dissolve-reactQuick start
import { useRef } from "react";
import { Dissolve, type DissolveHandle } from "dissolve-react";
function App() {
const ref = useRef<DissolveHandle>(null);
return (
<>
<Dissolve
ref={ref}
onComplete={() => console.log("done!")}
settings={{ duration: 2000 }}
>
<div>Your content here</div>
</Dissolve>
<button onClick={() => ref.current?.dissolve()}>
Dissolve
</button>
<button onClick={() => ref.current?.reset()}>
Reset
</button>
</>
);
}Props
| Prop | Type | Description |
|---|---|---|
| children | ReactNode | The content to wrap |
| onComplete | () => void | Callback fired when animation finishes |
| settings | Partial<DissolveSettings> | Override default animation settings |
| className | string | Class name for the wrapper div |
| style | CSSProperties | Inline styles for the wrapper div |
| ref | DissolveHandle | Imperative handle for controlling the animation |
Settings
| Property | Type | Default | Description |
|---|---|---|---|
| duration | number | 1150 | Animation duration in milliseconds |
| maxDisplacement | number | 3.2 | How far pixels scatter in UV space |
| bigNoiseFreq | number | 0.004 | Scale of turbulence patterns |
| bigNoiseSlope | number | 5.0 | Contrast of big noise |
| bigNoiseIntercept | number | -2.0 | Component transfer intercept |
| fineNoiseFreq | number | 2.7 | Detail grain frequency |
| noiseMix | number | 0.55 | 0 = only big noise, 1 = only fine noise |
| opacityFadeStart | number | 0.1 | Progress [0..1] at which opacity starts fading |
| easingPower | number | 2.0 | Easing exponent (1 = linear) |
| endScale | number | 1.05 | Scale factor at end of animation |
Presets
Complete control
Settings
duration
maxDisplacement
bigNoiseFreq
fineNoiseFreq
noiseMix
easingPower
endScale
opacityFadeStart