Skip to content

Commit

Permalink
Implement MixedColor and CurvedColor for all applicable colors
Browse files Browse the repository at this point in the history
Co-authored-by: Zachary Harrold <zac@harrold.com.au>
  • Loading branch information
lynn-lumen and bushrat011899 authored Mar 21, 2024
1 parent 0e92e2e commit a53cb81
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/animation/color_animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ use bevy::{

// We define this trait so we can reuse the same code for multiple color types that may be implemented using curves.
trait CurveColor: Point + Into<Color> + Send + Sync + 'static {}
impl CurveColor for LinearRgba {}
impl CurveColor for Oklaba {}
impl CurveColor for Xyza {}
impl<T: Point + Into<Color> + Send + Sync + 'static> CurveColor for T {}

// We define this trait so we can reuse the same code for multiple color types that may be implemented using mixing.
trait MixedColor: Mix + Into<Color> + Send + Sync + 'static {}
impl MixedColor for Oklcha {}
impl MixedColor for Srgba {}
impl MixedColor for Hsla {}
impl<T: Mix + Into<Color> + Send + Sync + 'static> MixedColor for T {}

#[derive(Debug, Component)]
struct Curve<T: CurveColor>(CubicCurve<T>);
Expand Down

0 comments on commit a53cb81

Please sign in to comment.