pub mod particle;
pub mod presets;
mod system;
pub use particle::{Particle, ParticleStyle};
pub use system::ParticleSystem;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum PresetEffect {
#[default]
RotatingHalo,
PulseRipple,
FlowingLight,
StardustScatter,
ElectricSpark,
SmokeWisp,
RainDrop,
LaserBeam,
LightningArc,
MeteorShower,
SonarPulse,
MatrixRain,
AuroraWave,
OrbitRings,
HeartbeatPulse,
CosmicStrings,
SilkRibbon,
}
#[derive(Debug, Clone)]
pub struct PresetEffectOptions {
pub particle_count: Option<usize>,
pub particle_size: (f32, f32),
pub particle_colors: Vec<[f32; 4]>,
pub speed: f32,
pub intensity: f32,
pub loop_effect: bool,
pub edge_width: f32,
pub ribbon_count: usize,
pub petal_amplitude: f32,
}
impl Default for PresetEffectOptions {
fn default() -> Self {
Self {
particle_count: None,
particle_size: (5.0, 10.0), particle_colors: vec![
[0.2, 0.9, 1.0, 1.0], [1.0, 0.3, 0.8, 1.0], [0.5, 1.0, 0.3, 1.0], [1.0, 0.8, 0.1, 1.0], ],
speed: 1.0,
intensity: 1.0,
loop_effect: true,
edge_width: 10.0,
ribbon_count: 2,
petal_amplitude: 20.0,
}
}
}
impl PresetEffectOptions {
pub fn with_colors(mut self, colors: Vec<[f32; 4]>) -> Self {
self.particle_colors = colors;
self
}
pub fn with_speed(mut self, speed: f32) -> Self {
self.speed = speed;
self
}
pub fn with_intensity(mut self, intensity: f32) -> Self {
self.intensity = intensity.clamp(0.0, 1.0);
self
}
pub fn with_particle_count(mut self, count: usize) -> Self {
self.particle_count = Some(count);
self
}
pub fn with_particle_size(mut self, min: f32, max: f32) -> Self {
self.particle_size = (min, max);
self
}
pub fn with_ribbon_count(mut self, count: usize) -> Self {
self.ribbon_count = count.max(1);
self
}
pub fn with_petal_amplitude(mut self, amplitude: f32) -> Self {
self.petal_amplitude = amplitude.max(0.0);
self
}
}