Animation

Splash Cursor

WebGL fluid simulation that splashes colourful dye wherever the pointer moves or clicks. Fullscreen click-through overlay by default, or contained in any positioned box — where the dye collides with the walls. Renders nothing under prefers-reduced-motion or without WebGL.

Angular adaptation of an effect by David Haz / reactbits.dev.

Import

import { WrSplashCursor } from 'ngwr/splash-cursor';

Playground

Move the pointer through the box — the dye swirls and bounces off the walls. Flip the fullscreen toggle to let it follow you across the whole page instead.

Move your mouse in here

<wr-splash-cursor [fullscreen]="false" [splatRadius]="0.2" [curl]="3" />

Customize

Rainbow
Color
Splat Radius
0.20
Curl
3
Fullscreen overlay

API

NameDescriptionTypeDefault
fullscreenViewport overlay, or fill the nearest positioned ancestor.booleantrue
simResolutionVelocity / pressure grid resolution.number128
dyeResolutionDye texture resolution (visible detail).number1440
densityDissipationDye fade speed — higher, shorter trails.number3.5
velocityDissipationHow fast motion settles.number2
pressurePressure retained between frames.number0.1
pressureIterationsJacobi iterations for the pressure solve.number20
curlVorticity confinement — swirliness.number3
splatRadiusSplat size.number0.2
splatForceVelocity a pointer move injects.number6000
shadingPseudo-3D shading on the dye.booleantrue
colorUpdateSpeedHow fast the splat colour cycles.number10
rainbowCycle splat colours through the rainbow.booleantrue
colorFixed splat colour when rainbow is off.string'#ff0000'