egui_elements/widgets/particles/mod.rs
1//! Particle effects for egui.
2//!
3//! Three effects: [`Snow`], ported from
4//! [`egui-snow`](https://github.com/LaVashikk/egui-snow) (MIT, Copyright (c) 2025
5//! LaVashikk, v0.36.0); [`Light`], soft radial glow motes and rising embers; and
6//! [`Lightning`], a jagged bolt with a full-area flash. All keep their per-frame
7//! state in egui's temporary data storage and paint on an egui layer, so they
8//! never disturb the host layout. Randomness uses an internal PRNG instead of
9//! `rand`, so the crate gains no dependency.
10//!
11//! Each effect ships a settings struct ([`SnowSettings`], [`LightSettings`],
12//! [`LightningSettings`]) that collects the public knobs and draws a themed
13//! settings window through `show_window`, or just the controls through `body_ui`
14//! for a host-provided container; `from_settings` turns the knobs into a
15//! configured effect.
16//!
17//! ```no_run
18//! use egui::Ui;
19//! use egui_elements::widgets::particles::{
20//! Light, LightSettings, Lightning, LightningSettings, Snow, SnowSettings,
21//! };
22//!
23//! fn particles(
24//! ui: &mut Ui,
25//! snow: &mut SnowSettings,
26//! light: &mut LightSettings,
27//! lightning: &mut LightningSettings,
28//! ) {
29//! snow.show_window(ui.ctx());
30//! light.show_window(ui.ctx());
31//! lightning.show_window(ui.ctx());
32//! if snow.active {
33//! Snow::from_settings("snow", snow).show(ui);
34//! }
35//! if light.active {
36//! Light::from_settings("light", light).show(ui);
37//! }
38//! if lightning.active {
39//! Lightning::from_settings(LightningSettings::STRIKE_ID, lightning).show(ui);
40//! }
41//! }
42//! ```
43
44mod light;
45mod lightning;
46pub(crate) mod shared;
47mod snow;
48
49pub use light::{Light, LightMotion, LightSettings};
50pub use lightning::{Lightning, LightningSettings};
51pub use shared::ParticleLayer;
52pub use snow::{Snow, SnowSettings};