Trait nannou_core::color::Mix
source · pub trait Mix {
type Scalar: Float;
// Required method
fn mix(&self, other: &Self, factor: Self::Scalar) -> Self;
}
Expand description
A trait for linear color interpolation.
use palette::{LinSrgb, Mix};
let a = LinSrgb::new(0.0, 0.5, 1.0);
let b = LinSrgb::new(1.0, 0.5, 0.0);
assert_eq!(a.mix(&b, 0.0), a);
assert_eq!(a.mix(&b, 0.5), LinSrgb::new(0.5, 0.5, 0.5));
assert_eq!(a.mix(&b, 1.0), b);
Required Associated Types§
Required Methods§
Object Safety§
This trait is not object safe.