Skip to main content

Module deckfx

Module deckfx 

Source
Expand description

Deck-level effects + theming — wires the theme palettes and the effects bloom/raven into the FacetDeck as opt-in, host-controllable features.

Three things a host gets, all off by default and cheap when off:

  1. Palette switching at runtimeDeckFx::cycle_palette / set_palette advance an index into Theme::ALL, and FacetDeck::palette_picker draws a one-line switcher the host can show anywhere. The deck applies the chosen palette with set_theme each frame.
  2. Glow on the active facet — toggle DeckFx::glow; when on, the deck blooms the active facet’s content rect with [effects::glow_rect] using the palette’s glow colour, pulsing with easing::ease_in_out_cubic.
  3. Summon the raven onto a target rect — [FacetDeck::send_raven] launches a RavenSprite that flies in and perches on any rect a facet/host hands it (e.g. a table row). The deck drives + paints it on a foreground layer.

The whole surface is additive: an existing deck keeps working unchanged until a host opts in via [FacetDeck::with_fx] / fx_mut.

Structs§

DeckFx
Opt-in deck effects config. Default is everything off (no palette override, no glow), so a deck that never touches it pays nothing.
DeckRaven
A raven launched through the deck, flying toward a perch rect. The deck owns one of these at a time (a fresh send_raven replaces it) and drives it on a foreground layer.

Functions§

launch_point
Where a deck raven launches from for a given perch: up-and-left, so it swoops down onto the row. Pure (testable without a context).
next_palette
Index of the next palette after current in Theme::ALL, wrapping. None (no current selection) maps to 0. Pure — the unit-tested cycle core.
palette_index
Resolve a palette name to its index in Theme::ALL (same fuzzy matching as Theme::by_name). None if unknown. Pure.