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§
Sourcefn plan(&mut self, state: &SceneState)
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.
Sourcefn sample(&self, alpha: f32, state: &mut SceneState)
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§
Trait Implementations§
Source§impl Animation for Box<dyn Animation>
impl Animation for Box<dyn Animation>
Source§fn plan(&mut self, state: &SceneState)
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)
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.Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".