tuigui 0.23.0

An easy-to-use, highly extensible, and speedy TUI library.
Documentation
use crate::{
    Transform,
    AnimationData,
};

pub trait Animation {
    /// Get canvas's animated transform
    fn animated_transform(&mut self, original_transform: Transform, duration_seconds: f64) -> Transform;

    /// Uses the duration that the animation has been
    /// running for to calculate whether or not the
    /// animation is done
    fn is_done(&self, duration_seconds: f64) -> bool;
}

pub fn animate<A: Animation>(
    animation: &mut A,
    animation_data: &AnimationData,
    original_transform: Transform,
    offset: f64,
) -> Transform {
    let duration = animation_data.duration().as_secs_f64() + offset;

    let animated_transform = animation.animated_transform(original_transform, duration);

    return animated_transform;
}