pub trait Animatable:
Copy
+ 'static
+ Default
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<f32, Output = Self> {
// Required methods
fn interpolate(&self, target: &Self, t: f32) -> Self;
fn magnitude(&self) -> f32;
// Provided method
fn epsilon() -> f32 { ... }
}Expand description
A simplified trait for types that can be animated
This trait leverages standard Rust operator traits for mathematical operations, reducing boilerplate and making implementations more intuitive. Only requires implementing interpolation and magnitude calculation.
Required Methods§
Sourcefn interpolate(&self, target: &Self, t: f32) -> Self
fn interpolate(&self, target: &Self, t: f32) -> Self
Interpolates between self and target using t (0.0 to 1.0)
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Animatable for f32
Implementation of Animatable for f32 primitive type
Much simpler with the new trait design - leverages standard Rust operators
impl Animatable for f32
Implementation of Animatable for f32 primitive type Much simpler with the new trait design - leverages standard Rust operators
Implementors§
impl Animatable for Color
Implementation of Animatable for Color Much simpler with the new trait design - uses standard operators
impl Animatable for Transform
Implementation of Animatable for Transform Much simpler with the new trait design - uses standard operators