Canvas
Fluid Simulation
OGL GPU fluid simulation — move the cursor to paint fluid. Animates autonomously while idle.
- lit
- ogl
Preview
GPU fluid simulation. Move the cursor to paint fluid while the scene animates autonomously when idle.
Attributes
Installation
pnpm dlx shadcn@latest add https://motion-kit-astro.vercel.app/r/fluid-simulation.json Usage
---
import "@/components/motion-kit/fluid-simulation-element.ts";
---
<motion-fluid-simulation
color="#ff6900"
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 | "#ff6900" |
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 |