Configuration

Full prop reference for FluidConfig. Every field is optional — the engine fills in defaults at construction time. Pass these as props to <Fluid> or any preset component.

Simulation

Core physics parameters that control grid resolution, dissipation, and solver behavior.

PropTypeDefaultDescription
simResolutionnumber128Velocity grid resolution.
dyeResolutionnumber1024Dye grid resolution. Clamped to 512 if linear filtering is unsupported.
densityDissipationnumber1How fast dye fades.
initialDensityDissipationnumbersame as densityDissipationStarting dissipation value, ramped to densityDissipation over the duration. No ramp by default.
initialDensityDissipationDurationnumber0Seconds over which to ramp from initial to steady dissipation. 0 disables the ramp.
velocityDissipationnumber0.2How fast velocity fades.
pressurenumber0.8Pressure solver weight.
pressureIterationsnumber20Pressure solver iterations per frame.
curlnumber30Vorticity confinement strength.

Splats

Control how pointer-driven splats are created.

PropTypeDefaultDescription
splatRadiusnumber0.25Splat radius in NDC units.
splatForcenumber6000Splat impulse force multiplier.
splatOnHoverbooleanfalseCreate splats on mouse move without requiring a click. No effect when pointerInput is false.
pointerInputbooleantrueEnable mouse and touch input.
pointerTarget'canvas' | 'window''canvas'Where to attach pointer listeners. 'window' drives the sim from pointer activity anywhere on the page.

Visuals

Shading, pointer color cycling, pause, and background.

PropTypeDefaultDescription
shadingbooleantrue3D-style shading effect.
colorfulbooleantrueRotate pointer/touch splat colors over time. Does not change hand-authored presetSplats.
colorUpdateSpeednumber10Pointer/touch color rotation rate (1/seconds). Only matters when colorful is true.
pausedbooleanfalsePause the simulation step. Rendering still occurs.
backColorRGB{ r: 0, g: 0, b: 0 }Background color in 0-255 RGB (CSS-style). Normalized internally before reaching the shader.
transparentbooleanfalseRender with a transparent background.

Bloom

Post-processing glow effect.

PropTypeDefaultDescription
bloombooleantrueEnable bloom effect.
bloomIterationsnumber8Bloom blur iterations.
bloomResolutionnumber256Bloom framebuffer resolution.
bloomIntensitynumber0.8Bloom intensity multiplier.
bloomThresholdnumber0.6Luminance threshold for bloom.
bloomSoftKneenumber0.7Bloom soft-knee curve.

Sunrays

Volumetric light ray effect.

PropTypeDefaultDescription
sunraysbooleantrueEnable sunrays effect.
sunraysResolutionnumber196Sunrays framebuffer resolution.
sunraysWeightnumber1Sunrays intensity weight.

Initial Splats

Splats created once at engine construction. These are construct-only (Bucket D) — changing them at runtime has no effect.

PropTypeDefaultDescription
initialSplatCountMinnumber5Minimum number of initial random splats.
initialSplatCountMaxnumber25Maximum number of initial random splats.
initialSplatCountnumber | undefinedExact initial splat count. Overrides min/max when set.
seednumberauto-generated32-bit unsigned integer seed for the deterministic PRNG. Reused across resizes for consistent patterns.
presetSplatsPresetSplat[]Hand-crafted splats applied after the random initial splats. Combine with initialSplatCount: 0 to suppress random splats.

Automatic Splats

Automatic splat generation for ambient motion without pointer input. Think of it as a timer that injects small bursts of dye and velocity.

PropTypeDefaultDescription
autoSplatRatenumber0Automatic burst rate in splats per second. 0 = disabled.
autoSplatCountnumber1Number of splats emitted each automatic burst.
autoSplatColorRGB | nullnullFixed color for automatic splats (0-1 linear range). null = fresh random color per splat.
autoSplatVelocityXnumber0X velocity for automatic splats (raw, not scaled by splatForce). Ignored when autoSplatSwirl is nonzero.
autoSplatVelocityYnumber0Y velocity for automatic splats (raw). Negative = downward in DOM. Ignored when autoSplatSwirl is nonzero.
autoSplatCenterYnumber0.5Vertical center of the spawn band: 0 = bottom, 0.5 = center, 1 = top.
autoSplatEvenXbooleanfalseWithin each burst, use equal x positions such as 25%, 50%, 75% instead of random x positions.
autoSplatSwirlnumber0Orbital velocity around the container/canvas center. Positive = counter-clockwise; negative = clockwise.
autoSplatBandHeightnumber0.1Height of the spawn band. 0 = one horizontal line, 0.1 = ±5%, 2.0 = full canvas.

Container

Confine the simulation to a geometric shape. The boundary is physically enforced, not just a visual clip.

PropTypeDefaultDescription
containerShapeContainerShape | nullnullShape constraint for the fluid. Supports circle, frame, roundedRect, annulus, and svgPath. null = full rectangle.
openBoundarybooleanfalseWhen true, fluid flows freely at boundaries instead of bouncing back. Shape becomes a visual crop, not a physical wall.

Glass

Simulates a glass vessel effect with refraction and specular highlights. Requires a containerShape.

PropTypeDefaultDescription
glassbooleanfalseEnable glass vessel post-processing. Ignored when containerShape is null.
glassThicknessnumber0.04Wall thickness in UV units. Controls how wide the refraction band is at the boundary.
glassRefractionnumber0.4Refraction strength, 0-1. Mapped internally to IOR 1.0-2.0.
glassReflectivitynumber0.12Specular reflectivity (Fresnel F0), 0-1. 0 = matte, 1 = mirror.
glassChromaticnumber0.15Chromatic aberration strength, 0-1. Splits refraction into R/G/B for prismatic fringes.

Reveal

Dye acts as an opacity mask — scratch to reveal content behind. Colors are in 0-1 linear range.

PropTypeDefaultDescription
revealbooleanfalseEnable reveal mode. Dye becomes a transparency mask with iridescent fringes.
revealSensitivitynumber0.1Multiplier on dye intensity before the power curve. Higher = easier reveal.
revealCurvenumber0.5Power exponent for reveal alpha. Higher = crisper edge, lower = softer gradient.
revealCoverColorRGB{ r: 1, g: 1, b: 1 }Cover layer color (0-1 linear). Visible before scratching.
revealAccentColorRGB{ r: 0.05, g: 0.16, b: 0.32 }Fringe accent color (0-1 linear). Shown between cover and revealed content.
revealFringeColorRGB{ r: 0.6, g: 0.7, b: 0.85 }Outer fringe color (0-1 linear). Creates a two-tone fringe: cover → fringe → accent → transparent.

Distortion

Velocity field warps an underlying image like liquid glass. Mutually exclusive with reveal.

PropTypeDefaultDescription
distortionbooleanfalseEnable distortion mode. Cursor movement ripples and warps the image.
distortionPowernumber0.4How strongly velocity warps UV coordinates, 0-1.
distortionImageUrlstringURL of the image to distort. Required when distortion is true. Loaded asynchronously.
distortionFit'cover' | 'contain''cover'How the image fits the canvas. 'cover' fills and crops, 'contain' fits within.
distortionScalenumber1.0Image scale factor. Values > 1 zoom out, < 1 zoom in.
distortionBleedXnumber0Horizontal bleed fraction (0-0.5). Canvas extends invisibly beyond visible area to prevent edge bounce.
distortionBleedYnumber0Vertical bleed fraction (0-0.5). See distortionBleedX.

Sticky

Dye clings to a mask region by modulating physics. Composable with container shapes, bloom, sunrays, and glass. Mutually exclusive with reveal and distortion.

PropTypeDefaultDescription
stickybooleanfalseEnable sticky mode. Triggers mask texture rebuild.
stickyMaskStickyMaskMask shape that dye sticks to. Supports text, SVG paths, or both. Required when sticky is true.
stickyStrengthnumber0.9How strongly dissipation is reduced on the mask, 0-1. 1 = dye never fades on mask.
stickyPressurenumber0.15Artificial pressure on the mask to push fluid around the shape.
stickyAmplifynumber0.3Splat intensity multiplier on the mask region. Higher = more dye deposited.

Hot-update buckets

When props change at runtime, setConfig() classifies each field into one of four buckets that determine how the change takes effect:

Bucket A — Hot scalars

Written directly to the internal config object and picked up on the next simulation frame. Zero overhead. Most numeric props live here: densityDissipation, velocityDissipation, pressure, curl, splatRadius, splatForce, colorUpdateSpeed, bloomIntensity, sunraysWeight, all autoSplat* props, all glass* scalars, all reveal* scalars, all distortion* scalars, stickyStrength, stickyPressure, stickyAmplify, pointerTarget, and openBoundary.

Bucket B — Keyword recompile

Triggers a display shader recompile (~1 ms). Applies to feature toggles that change which GLSL code paths are active: shading, bloom, sunrays, reveal, and distortion.

Bucket C — FBO rebuild

Triggers framebuffer reallocation. Applies to resolution fields: simResolution, dyeResolution, bloomResolution, bloomIterations, and sunraysResolution. Also triggered by containerShape changes (mask texture rebuild) and glass toggle (scene FBO alloc/dispose).

Bucket D — Construct-only

Ignored by setConfig() after construction. These values are consumed once when the engine is created: seed, initialSplatCountMin, initialSplatCountMax, initialSplatCount, and presetSplats.