pub struct IceDrip { /* private fields */ }Expand description
Ice-drip decor — a row of icicles along the top edge of a rect with
melt-droplets that fall under gravity, fade out, and recur, plus a faint
frost shimmer along the edge. The signature decor of the Skaði “Skade
Vinter” winter scene (pairs with crate::look::Theme::skade_vinter).
Pure CPU — layered alpha shapes on an egui::Painter, no GPU/backend risk —
time-driven and deterministic given (seed, clock), so it is headless-
testable exactly like ParticleBurst / RavenSprite. It is off unless
enabled (the gate); paint_gated also
follows the active theme’s EffectsPolicy so it
stays dark under Reduced/None/Device.
let mut drip = IceDrip::new(12, 0).enabled(true);
drip.set_clock(ui.input(|i| i.time)); // time-driven
drip.paint_gated(ui, ui.max_rect()); // honours EffectsPolicyImplementations§
Source§impl IceDrip
impl IceDrip
Sourcepub fn new(count: usize, seed: u64) -> Self
pub fn new(count: usize, seed: u64) -> Self
count icicles across the top edge, jittered deterministically by seed
(SplitMix64 — no RNG crate). Default icy palette; disabled by default
(the gate) — call enabled(true) to turn it on.
Sourcepub fn with_period(self, secs: f32) -> Self
pub fn with_period(self, secs: f32) -> Self
Drip cycle length in seconds (one droplet per cycle). Builder form.
Sourcepub fn at_clock(self, secs: f32) -> Self
pub fn at_clock(self, secs: f32) -> Self
Pin the clock up front (builder form of set_clock) —
the testable, deterministic entry point.
Sourcepub fn set_clock(&mut self, secs: f32)
pub fn set_clock(&mut self, secs: f32)
Set the absolute scene time (drive from ui.input(|i| i.time)).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Is the decor on?
Sourcepub fn paint(&self, painter: &Painter, rect: Rect)
pub fn paint(&self, painter: &Painter, rect: Rect)
Paint the icicles + falling melt-droplets + frost shimmer onto painter,
hanging from the top edge of rect. No-op unless enabled.
Sourcepub fn paint_gated(&self, ui: &Ui, rect: Rect)
pub fn paint_gated(&self, ui: &Ui, rect: Rect)
Paint only if the active theme’s EffectsPolicy
allows decorative motion (i.e. Full) — so the decor follows the theme
(dark under Reduced/None/Device) on top of its own enabled
gate. Reads the policy published by crate::look::Theme::apply.
Sourcepub fn state_json(&self) -> Value
pub fn state_json(&self) -> Value
Observable state for headless / robot tests (the state_json hook): the
gate, the icicle count, the live droplets (each x + normalised fall +
alpha), the frost phase, and the clock. Asserted as DATA, not pixels.