Water Effect¶
See Water, smoke, cloth, and procedural worlds for presets, controls, units, and resize behavior.
A damped water surface with reflecting edges and interacting ripples.
- class bruhanimate.bruheffect.water_effect.WaterEffect(buffer: Buffer, background: str, settings: WaterSettings | None = None)[source]¶
Bases:
BaseEffectFinite-difference waves. Use drop() to inject an impulse at a local cell.
Updates advance one tick. Draw only copies the current raster. Resize keeps both displacement and velocity in the top-left overlap, adding still water.
- __init__(buffer: Buffer, background: str, settings: WaterSettings | None = None) None[source]¶
Base class for all effects.
- Parameters:
buffer (Buffer) – Effect buffer to push updates to.
background (str) – character or string to use for the background.
seed – Non-negative integer for independent Python and NumPy random streams. None uses fresh entropy. Global RNG state is untouched.
- drop(x: int, y: int, strength: float = 1.0) None[source]¶
Add displacement for the next update; out-of-bounds cells are ignored.
strength is finite and in [-5, 5]; negative impulses make a depression. Coordinates are integer cells in the effect’s own viewport.
- resize(size: tuple[int, int]) None[source]¶
Change the drawing viewport, retaining the original simulation raster.
Shrinking clips from the bottom/right; growing reveals the original raster again. Cells beyond it remain transparent to the owner. Random streams, resource handles and simulation coordinates are unchanged. Subclasses can override this typed hook to adapt simulation arrays and repaint the private raster at the current tick, then call super().resize. Built-in adapters use this contract; draw must still never advance time.