Sand Cursor
v1.0.0FreeWebGLCursorInteractive
An interactive WebGL sand canvas particle field that deforms dynamically on pointer movement using React Three Fiber.
Sand Cursor
Installation
npx vectorvesper add magnetic-sandRun npx vectorvesper init once first to set up your project.
Dependencies
npm install three @react-three/fiber- three
- @react-three/fiber
Usage
Import
Usage
Client-only component — disable SSR
This component uses WebGL and must be rendered client-side only.
Props
An interactive particle canvas simulation. Hundreds of virtual sand grains align themselves in a grid, reacting to mouse proximity by jittering, heating up, and gravitating toward the cursor with springy magnetic physics. Built on WebGL for optimal performance.
<MagneticSandVisualizer />
WebGL canvas component displaying the sand particle field.
| Prop | Type | Default | Description |
|---|---|---|---|
backgroundColor | string | "#ffffff" | Canvas background hex color. |
color1 | string | "#000000" | Primary particle color when resting (inactive state). |
color2 | string | "#00eeff" | Active glow color of particles when attracted/heated by the cursor. |
particleSize | number | 0.0 | Base size scale of the sand particles. Grains expand dynamically when near the cursor. |
gridResolution | number | 140.0 | Grid density layout. Higher values result in smaller and more numerous particles. |
glowIntensity | number | 0.3 | Brightness of the cursor attraction glow. |
trailSpeed | number | 0.05 | Damping trail coefficient. Controls how long particles retain their heat/charge after the mouse leaves. |
className | string | "" | Extra CSS class names for the outer container. |
Examples
WebGL component. Requires browser canvas APIs. Must be imported dynamically with
ssr: false.Applies a performance optimization that limits the canvas maximum devicePixelRatio to 1.5. This maintains high quality while significantly lowering pixel shading overhead on high-DPI displays.