@@ 34,7 34,9 @@ pub fn particle_editor_plugin(app: &mut App) {
});
}
-fn setup_editor_effect(mut commands: Commands) {
+fn setup_editor_effect(
+ mut commands: Commands,
+) {
commands.spawn((
ParticleEffect {
lifetime_seconds: RandF32 {
@@ 1,7 1,6 @@
use std::collections::BTreeMap;
use std::ops::Bound::{Included, Unbounded};
use bevy::color::{Color, LinearRgba};
-use bevy::math::cubic_splines::LinearSpline;
use bevy::math::Vec2;
use bevy::prelude::Component;
use ordered_float::{FloatCore, OrderedFloat};
@@ 64,9 63,11 @@ impl<P: Lerp + Copy> LifetimeCurve<P> {
Some(a_val.lerp(b_val, t))
}
- pub fn clamp_time(&self, time: f32) -> Option<f32> {
- let Some(first) = self.0.iter().nth(0) else { return None };
- let Some(last) = self.0.iter().last() else { return None };
+ /// Given an input time value, use the ends of the spline's time to clamp
+ /// the input value.
+ pub fn clamp_time(&self, time: f32) -> Option<f32> {
+ let Some(first) = self.0.iter().nth(0) else { return None; };
+ let Some(last) = self.0.iter().last() else { return None; };
Some(time.clamp(first.0.0, last.0.0))
}