Skip to main content

Animator

Trait Animator 

Source
pub trait Animator {
    // Required methods
    fn animate(&self, key: AnimKey, goal: f32, over: Duration) -> f32;
    fn pointer_world(&self) -> Option<Pos2>;
}
Expand description

The frame-driven half of a live canvas: where the pointer is, and what a keyed easing is currently worth. Split out of Canvas because the generic render path reaches it through Renderer::animator on a &dyn — an offline backend has no pointer and no clock, and those overlays fall back to a static draw.

Required Methods§

Source

fn animate(&self, key: AnimKey, goal: f32, over: Duration) -> f32

The current value of the easing keyed by key, moving toward goal over over. Polled every frame: the host holds the value between frames and interpolates it by however long the last frame took.

Source

fn pointer_world(&self) -> Option<Pos2>

The pointer in world space, if it is over the canvas.

Implementors§