ranim 0.1.0-alpha.6

An animation engine inspired by manim and JAnim
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use color::{AlphaColor, ColorSpace};

pub trait Interpolatable {
    fn lerp(&self, target: &Self, t: f32) -> Self;
}

impl Interpolatable for f32 {
    fn lerp(&self, target: &Self, t: f32) -> Self {
        self + (target - self) * t
    }
}

impl<CS: ColorSpace> Interpolatable for AlphaColor<CS> {
    fn lerp(&self, other: &Self, t: f32) -> Self {
        // TODO: figure out to use `lerp_rect` or `lerp`
        AlphaColor::lerp_rect(*self, *other, t)
    }
}