Skip to content

FishTankEffect

Source: FishTankEffect.h

FishTankEffect

class FishTankEffect
src/light/effects/FishTankEffect.h:114

Inherits: EffectBase

Effect: colorful fish swim across a dark tank, each tinted from the active palette.

FishTankEffect card FishTankEffect controls

Inspired by the aquarium screensavers of the After Dark era, with the art drawn fresh here. Movement is particles::Pool and appearance is [draw::sprite], as FlyingToasters does.

Public Attributes

uint8_t fish = 3 : How many of the broad tropical shape swim.

uint8_t slim = 3 : How many of the slender shape swim.

uint8_t tiny = 5 : How many of the tiny schooling fish swim.

uint8_t speed = 80 : How fast the tank swims, in body lengths a second.

uint8_t spriteSize = 0 : Pixels per art pixel, where 0 scales with the grid.

bool audioReactive = false : Move to the music, each sprite on its own band, holding still in silence.

Public Methods

virtual inline const char * tags() const override : Catalog tags: the audio glyph applies when audioReactive is set.

virtual inline Dim dimensions() const override : A tank needs a width and a height, so it is a 2D effect.

virtual inline void defineControls() override : Publish the three counts, the speed, the sprite scale and the audio switch.

virtual inline void prepare() override : Size the pool's storage, wire the view over it, and fill the tank.

inline uint8_t spriteScale() const : The sprite magnification, grid-proportional when spriteSize is 0, as FlyingToasters does.

virtual inline void tick() override : Step every fish, respawn what swam out, and draw each through its own palette.

Public Static Attributes

constexpr uint8_t kPool = 24 : The pool size: the three count controls at their maxima, summed.

More info

One shape, as many colorways as there are fish

A Sprite points at its palette rather than owning one. So each fish is drawn through a palette this effect fills from the user's active one. That is why the art carries shade roles, body and dark and light, rather than fixed colors. The reference aquarium's appeal is the mix, and a tank of one color is not that.