reactionDiffusion
import { reactionDiffusion, useTexture } from "@pibbl/core/textures";// Inside a Pibbl component:const ink = useTexture(reactionDiffusion({ seed: 42, preset: "stripes" }), { resolution: { width: 128, height: 48 }, palette: ["#031a22", "#087c80", "#38c8a5", "#a8f5d8"],});// From an event or useReaction, outside component evaluation:ink.send({ type: "pause", paused: true });ReactionDiffusionOptions accepts seed (unsigned 32-bit integer, default 42) and preset ('spots' by default, or 'stripes'). Different palettes are different presentations of the same supported simulation, not new algorithms.
InkMessage includes pause, reset, paint, and stir. Paint uses normalized u and v between zero and one, a radius in texture cells (default 6, greater than zero and at most 128), and strength between zero and one (default 0.8). Reset repeats the configured seed. Stir displaces the existing field; it does not create a fluid solver or reciprocal physics forces.
The texture advances on Pibbl’s scheduler. Do not call send during component evaluation. Use an event handler or useReaction. The complete native-button recipe shows scheduling, pause, sizing, and disposal. Living Ink in the editor provides paint, reset, and seed controls.
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.