A framework-agnostic GPU fluid simulation library for the web using Stable Fluids on WebGL2, with pluggable render modes and React/Vue/Svelte adapters.

Stars

8

7-day growth

No data

Forks

0

Open issues

0

License

MIT

Last updated

2026-07-28

Why it is worth attention

Combines high-quality GPU fluid simulation with easy integration through framework adapters, live-tunable parameters, multiple emitter types, and experimental WebGPU support, plus built-in performance optimizations and accessibility features.

Who it is for

  • Web developers building interactive landing pages or visual effects
  • React, Vue, or Svelte developers seeking ready-made fluid components
  • Creative coders and artists exploring real-time generative art
  • AI coding agents (dedicated AGENTS.md guide)

Use cases

  • Interactive background fluids for marketing or product pages
  • Real-time visual effects in creative coding or generative art projects
  • Audio-reactive visualizations (via audio emitter)
  • Educational demos illustrating fluid dynamics concepts

Strengths

  • Framework-agnostic with official adapters for React, Vue, and Svelte
  • Five render modes (dye, threshold, ramp, displacement, custom) plus WebGPU backend
  • Multiple emitter types: pointer, ambient, mask, programmatic, and audio
  • All simulation parameters are live-tunable; includes auto-quality reduction for performance

Considerations

  • Requires WebGL2 with EXT_color_buffer_float (not supported on very old devices)
  • Experimental WebGPU backend limited to dye rendering and basic emitters only
  • Version v0.5 may have rough edges or incomplete features (e.g., masks/obstacles still WebGL2-only)

README quick start

fluidkit

Live demo → · npm

Framework-agnostic GPU fluid simulation for the web. The sim engine (Stable Fluids on WebGL2) produces velocity/dye field textures; pluggable render modes consume them — smoky dye, flat posterized "sticker" liquid, or your own fragment shader.

Status: v0.5 — WebGL2 core with five render modes (dye, threshold, ramp, displacement, custom); pointer, ambient, programmatic, mask, and audio emitters; obstacles; React/Vue/Svelte adapters; CDN build; experimental WebGPU backend (try it).

Building with an AI coding agent? Point it at AGENTS.md — a complete guide with landing-page recipes, the liquid-vs-smoke look formula, and pitfalls.

Quickstart

npm install @dilukangelo/fluidkit
import { createFluid, threshold } from '@dilukangelo/fluidkit'

const fluid = createFluid(canvas, {
  emitters: { pointer: true, ambient: { strength: 0.2 } },
  render: threshold({
    levels: [{ cutoff: 0.1, color: '#ffc7ff' }],
    background: 'transparent',
  }),
})

That's it — interactive fluid on your canvas. Omit render for the classic smoky dye look.

API

fluid.splat(x, y, dx, dy, { color: '#ffc7ff', radius: 0.25 }) // programmatic droplet, x/y in [0,1], y up
fluid.params.curl = 45                                        // all sim params live-tunable
fluid.setRenderMode(dye())                                    // swap looks at runtime
const tex = fluid.getTexture('dye')                           // raw WebGLTexture for three.js/pixi
fluid.pause(); fluid.resume(); fluid.destroy()

Sim params (all optional in createFluid options, all live-tunable via fluid.params): simResolution (128), dyeResolution (1024), curl (30), pressureIterations (20), pressure (0.8), velocityDissipation (0.2), densityDissipation (1.0), gravity (0 — set 100–400 for pours/waterfalls), wind (0), speed (1), splatRadius (0.25), splatForce (6000).

Render modes

  • dye({ brightness, glow, glowRadius, background }) — classic smoky multicolor, with an optional neon halo.
  • threshold({ levels, background, outline, softness, lighting }) — up to 8 posterized levels with per-level alpha, edge A

Description

Framework-agnostic WebGL2 fluid simulation — decoupled sim engine + pluggable render modes (smoky dye, flat sticker-liquid, custom shaders). AI-agent ready.

Related repositories

Similar projects matched by category, topics, and programming language.

gnipbao
Featured
gnipbao GitHub avatar

story-to-handdrawn-video

A Remotion-based tool that converts Chinese story text or ordered hand-drawn images into vertical hand-drawn diary-comic animation with handwritten captions, left-to-right reveals, optional page-curl transitions, and silent H.264 output for post-production dubbing.

AI & Machine LearningAI Agents
683
makecindy
Featured
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI & Machine LearningLarge Language Models
958
mereyabdenbekuly-ctrl
Featured
mereyabdenbekuly-ctrl GitHub avatar

clodex-ide

Clodex is an open-source, local-first agentic IDE that combines persistent AI tasks, code, terminal, browser, Git, models, memory, and governed execution in one Electron workspace, currently in technical preview.

AI & Machine LearningAI Agents
859