Add Color::lerp()
This commit is contained in:
parent
4798d43f6c
commit
681b884b74
|
@ -168,6 +168,12 @@ impl Color {
|
|||
pub fn with_alpha(&self, alpha: u8) -> Self {
|
||||
Self(self.0 & 0xffffff00 | alpha as u32)
|
||||
}
|
||||
|
||||
pub fn lerp(self, target: Self, blend: f32) -> Self {
|
||||
let s: glam::Vec4 = self.into();
|
||||
let o: glam::Vec4 = target.into();
|
||||
(o * blend + s * (1.0 - blend)).into()
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
|
Loading…
Reference in New Issue