pub struct Animatable<T: SpringScalar + 'static> { /* private fields */ }Expand description
Generic animatable value holder.
Implementations§
Source§impl<T: SpringScalar + 'static> Animatable<T>
impl<T: SpringScalar + 'static> Animatable<T>
Sourcepub fn new(initial: T, runtime: RuntimeHandle) -> Self
pub fn new(initial: T, runtime: RuntimeHandle) -> Self
Create a new animatable with the given initial value.
Sourcepub fn animateTo(&mut self, target: T, animation: AnimationType)
pub fn animateTo(&mut self, target: T, animation: AnimationType)
Animate to the target value using the specified animation.
Retargeting mid-flight keeps the in-flight velocity (springs continue their physical motion toward the new target).
Sourcepub fn animate_to_with_velocity(
&mut self,
target: T,
velocity: T,
animation: AnimationType,
)
pub fn animate_to_with_velocity( &mut self, target: T, velocity: T, animation: AnimationType, )
Animate to target, seeding the spring with velocity (value units
per second, per dimension) — the gesture-handoff entry point: pass the
release velocity so the animation continues the finger’s motion.
Sourcepub fn animate_to_with_velocity_at(
&mut self,
target: T,
velocity: T,
animation: AnimationType,
start_time_nanos: u64,
)
pub fn animate_to_with_velocity_at( &mut self, target: T, velocity: T, animation: AnimationType, start_time_nanos: u64, )
Animate from an exact point on the shared frame clock. The first rendered spring sample integrates every elapsed nanosecond since this boundary, so input-to-animation handoff is independent of which vsync first services the callback.
Sourcepub fn velocity(&self) -> T
pub fn velocity(&self) -> T
The current velocity in value units per second (zero when settled).
Sourcepub fn animation_type(&self) -> AnimationType
pub fn animation_type(&self) -> AnimationType
Return the animation spec currently driving this animatable.