@@ 27,20 27,18 @@ fn setup_editor_effect(mut commands: Commands) {
},
initial_angular_velocity: RandF32 { value: 1.0, randomness: 0.5 },
scale: LifetimeCurve::new(&[
- (0.0, 5.0),
+ (0.0f32, 5.0),
(2.0, 0.0)
]),
color: LifetimeCurve::new(&[
- (0.0, Srgba::new(1.0, 0.0, 0.0, 1.0)),
- (0.5, Srgba::new(0.0, 1.0, 0.0, 1.0)),
- (1.0, Srgba::new(0.0, 0.0, 1.0, 1.0)),
- (1.5, Srgba::new(1.0, 0.0, 1.0, 1.0)),
- (2.0, Srgba::new(1.0, 1.0, 1.0, 1.0))
+ (0.0f32, Srgba::new(1.0, 0.0, 0.0, 1.0).into()),
+ (0.5, Srgba::new(0.0, 1.0, 0.0, 1.0).into()),
+ (1.0, Srgba::new(0.0, 0.0, 1.0, 1.0).into()),
+ (1.5, Srgba::new(1.0, 0.0, 1.0, 1.0).into()),
+ (2.0, Srgba::new(1.0, 1.0, 1.0, 1.0).into())
]),
}
));
}
-fn editor_ui(app: &mut App) {
-
-}>
\ No newline at end of file
+fn editor_ui() {}<
\ No newline at end of file
@@ 39,9 39,9 @@ pub struct ParticleEffect {
#[derive(Serialize, Deserialize)]
pub struct LifetimeCurve<P: Lerp>(BTreeMap<OrderedFloat<f32>, P>);
-impl<P: Lerp> LifetimeCurve<P> {
- pub fn new(points: impl IntoIterator<Item = (f32, P)>) -> Self {
- Self(BTreeMap::from_iter(points.into_iter().map(|u| (OrderedFloat(u.0), u.1))))
+impl<P: Lerp + Copy> LifetimeCurve<P> {
+ pub fn new<'a>(points: impl IntoIterator<Item = &'a (f32, P)>) -> Self where P: 'a {
+ Self(BTreeMap::from_iter(points.into_iter().map(|u| (OrderedFloat(u.0), u.1.clone()))))
}
/// Sample for the value at T. Returns None if the curve has no points, or if T is outside