Skip to main content

Animation

Trait Animation 

Source
pub trait Animation: Send + Sync {
    // Required methods
    fn plan(&mut self, state: &SceneState);
    fn sample(&self, alpha: f32, state: &mut SceneState);

    // Provided methods
    fn duration(&self) -> f32 { ... }
    fn rate_fn(&self) -> RateFn { ... }
}
Expand description

Something that changes the scene over a clip.

Required Methods§

Source

fn plan(&mut self, state: &SceneState)

Called once when played, with the scene state at the start of the clip. Do the expensive work (alignment, diffing) here.

Source

fn sample(&self, alpha: f32, state: &mut SceneState)

Writes the targets’ state at eased progress alpha into state, which holds the scene as it was at the start of the clip. Must be cheap and pure.

Provided Methods§

Source

fn duration(&self) -> f32

Length in seconds.

Source

fn rate_fn(&self) -> RateFn

Easing applied to progress before sample.

Trait Implementations§

Source§

impl Animation for Box<dyn Animation>

Source§

fn plan(&mut self, state: &SceneState)

Called once when played, with the scene state at the start of the clip. Do the expensive work (alignment, diffing) here.
Source§

fn sample(&self, alpha: f32, state: &mut SceneState)

Writes the targets’ state at eased progress alpha into state, which holds the scene as it was at the start of the clip. Must be cheap and pure.
Source§

fn duration(&self) -> f32

Length in seconds.
Source§

fn rate_fn(&self) -> RateFn

Easing applied to progress before sample.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Animation for Box<dyn Animation>

Source§

fn plan(&mut self, state: &SceneState)

Source§

fn sample(&self, alpha: f32, state: &mut SceneState)

Source§

fn duration(&self) -> f32

Source§

fn rate_fn(&self) -> RateFn

Implementors§