pub trait Animatable {
type Output;
// Required method
fn evaluate(&self, t: f32) -> Self::Output;
// Provided methods
fn curved(self, curve: Curve) -> Curved<Self>
where Self: Sized { ... }
fn animate<'a>(
&'a self,
controller: &'a AnimationController,
) -> Animation<'a, Self>
where Self: Sized { ... }
}Expand description
A value that can be shaped by a [0,1] progress value — the abstraction
tweens and curves share. It is the bridge between the explicit side (an
AnimationController producing a [0,1] frame by frame) and a typed value:
tween.animate(&controller).value() reads the current colour, size or point at
any instant, without the view knowing the controller as anything other than
that value.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn curved(self, curve: Curve) -> Curved<Self>where
Self: Sized,
fn curved(self, curve: Curve) -> Curved<Self>where
Self: Sized,
Chains a Curve before evaluation: t is shaped by the curve first,
so a single linear progress value can drive a value with non-linear timing.
Sourcefn animate<'a>(
&'a self,
controller: &'a AnimationController,
) -> Animation<'a, Self>where
Self: Sized,
fn animate<'a>(
&'a self,
controller: &'a AnimationController,
) -> Animation<'a, Self>where
Self: Sized,
Binds this animation to an AnimationController’s progress, producing an
Animation whose value() follows the controller’s current value. The
controller’s value is normalised by its own bounds, so a non-unit
controller still drives a full [0,1].
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".