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-react

Quick 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

PropTypeDescription
childrenReactNodeThe content to wrap
onComplete() => voidCallback fired when animation finishes
settingsPartial<DissolveSettings>Override default animation settings
classNamestringClass name for the wrapper div
styleCSSPropertiesInline styles for the wrapper div
refDissolveHandleImperative handle for controlling the animation

Settings

PropertyTypeDefaultDescription
durationnumber1150Animation duration in milliseconds
maxDisplacementnumber3.2How far pixels scatter in UV space
bigNoiseFreqnumber0.004Scale of turbulence patterns
bigNoiseSlopenumber5.0Contrast of big noise
bigNoiseInterceptnumber-2.0Component transfer intercept
fineNoiseFreqnumber2.7Detail grain frequency
noiseMixnumber0.550 = only big noise, 1 = only fine noise
opacityFadeStartnumber0.1Progress [0..1] at which opacity starts fading
easingPowernumber2.0Easing exponent (1 = linear)
endScalenumber1.05Scale factor at end of animation