Trait immi::animations::Interpolation [] [src]

pub trait Interpolation {
    fn calculate(&self, now: u64, start: u64, duration_ns: u64) -> f32;
}

Describes how an animation should be interpolated.

Required Methods

fn calculate(&self, now: u64, start: u64, duration_ns: u64) -> f32

Takes a number of ticks (in nanoseconds) representing the current point in time, a number of ticks representing the point in time when the animation has started or will start, the duration in nanoseconds, and returns a value between 0.0 and 1.0 representing the progress of the animation.

Implementations typically return 0.0 when now < start and 1.0 when now > start + duration_ns.

Implementors