Canvas
Fluid Simulation
OGL GPU fluid simulation — move the cursor to paint fluid. Animates autonomously while idle.
Preview
GPU fluid simulation. Move the cursor to paint fluid while the scene animates autonomously when idle.
Attributes
Installation
pnpm dlx motion-blocks add fluid-simulation Usage
---import "@/components/motion-blocks/fluid-simulation-element.ts";--- <motion-fluid-simulation color="#6c87bc" background-color="#17181A" dissipation={0.96} pointer-size={0.005} class="w-full h-[500px]"/> API Reference
| Attribute | Type | Default |
|---|---|---|
dissipation How quickly the fluid density dissipates over time (lower = faster fade). | number | 0.96 |
pointer-size Size of the cursor's influence on the fluid simulation. | number | 0.005 |
color Color of the fluid being painted (any CSS color value). | string | "#6c87bc" |
background-color Background color of the canvas (any CSS color value). | string | "#17181A" |
velocity-dissipation How quickly fluid velocity dissipates (affects swirl duration). | number | 0.96 |
pressure-iterations Number of pressure solver iterations (higher = more accurate but slower). | number | 10 |

