pub trait AnimationEngine {
// Required methods
fn is_available(&self) -> bool;
fn animate(
&mut self,
animation: &AnimationConfig,
) -> Result<AnimationHandle, AnimationError>;
fn stop(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>;
fn pause(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>;
fn resume(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>;
fn tick(&mut self, timestamp: f64) -> Result<(), AnimationError>;
fn get_state(
&self,
handle: AnimationHandle,
) -> Result<PlaybackState, AnimationError>;
fn is_running(&self, handle: AnimationHandle) -> bool;
fn get_performance_metrics(&self) -> Option<()>;
}Expand description
Core animation engine trait
Required Methods§
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Check if this engine is available in current environment
Sourcefn animate(
&mut self,
animation: &AnimationConfig,
) -> Result<AnimationHandle, AnimationError>
fn animate( &mut self, animation: &AnimationConfig, ) -> Result<AnimationHandle, AnimationError>
Start an animation and return a handle
Sourcefn stop(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>
fn stop(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>
Stop an animation by handle
Sourcefn pause(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>
fn pause(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>
Pause an animation
Sourcefn resume(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>
fn resume(&mut self, handle: AnimationHandle) -> Result<(), AnimationError>
Resume a paused animation
Sourcefn tick(&mut self, timestamp: f64) -> Result<(), AnimationError>
fn tick(&mut self, timestamp: f64) -> Result<(), AnimationError>
Update all animations (for RAF-based engines)
Sourcefn get_state(
&self,
handle: AnimationHandle,
) -> Result<PlaybackState, AnimationError>
fn get_state( &self, handle: AnimationHandle, ) -> Result<PlaybackState, AnimationError>
Get current playback state
Sourcefn is_running(&self, handle: AnimationHandle) -> bool
fn is_running(&self, handle: AnimationHandle) -> bool
Check if an animation is running
Sourcefn get_performance_metrics(&self) -> Option<()>
fn get_performance_metrics(&self) -> Option<()>
Get performance metrics (no-op when feature disabled)