pub struct AnimatedValue<T> { /* private fields */ }Expand description
A value animated by elapsed time: call AnimatedValue::tick with each
frame’s delta. Retargeting keeps momentum like MotionValue.
Implementations§
Source§impl<T> AnimatedValue<T>
impl<T> AnimatedValue<T>
pub fn new(initial: T) -> AnimatedValue<T>
pub fn with_duration(self, seconds: f32) -> AnimatedValue<T>
pub fn with_easing(self, easing: Easing) -> AnimatedValue<T>
pub fn with_spec(self, spec: AnimationSpec) -> AnimatedValue<T>
Sourcepub fn set_duration(&mut self, seconds: f32)
pub fn set_duration(&mut self, seconds: f32)
Use a tween of seconds for later targets, keeping the easing.
Sourcepub fn set_easing(&mut self, easing: Easing)
pub fn set_easing(&mut self, easing: Easing)
Use a tween with easing for later targets, keeping the duration.
pub fn set_spec(&mut self, spec: AnimationSpec)
pub fn spec(&self) -> AnimationSpec
pub fn set_target(&mut self, target: T)
Sourcepub fn set_target_after(&mut self, target: T, delay: f64)
pub fn set_target_after(&mut self, target: T, delay: f64)
Like AnimatedValue::set_target, starting delay seconds of ticks
from now.
pub fn jump_to(&mut self, value: T)
Sourcepub fn tick(&mut self, delta_seconds: f32) -> bool
pub fn tick(&mut self, delta_seconds: f32) -> bool
Advance by delta_seconds. Returns whether the value is still
animating.
pub fn value(&self) -> T
pub fn target(&self) -> T
pub fn is_animating(&self) -> bool
Trait Implementations§
Source§impl<T> Clone for AnimatedValue<T>where
T: Clone,
impl<T> Clone for AnimatedValue<T>where
T: Clone,
Source§fn clone(&self) -> AnimatedValue<T>
fn clone(&self) -> AnimatedValue<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T> Copy for AnimatedValue<T>where
T: Copy,
Source§impl<T> Debug for AnimatedValue<T>where
T: Debug,
impl<T> Debug for AnimatedValue<T>where
T: Debug,
Source§impl<T> PartialEq for AnimatedValue<T>where
T: PartialEq,
impl<T> PartialEq for AnimatedValue<T>where
T: PartialEq,
impl<T> StructuralPartialEq for AnimatedValue<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Forget for AnimatedValue<T>
impl<T> Freeze for AnimatedValue<T>
impl<T> Move for AnimatedValue<T>
impl<T> RefUnwindSafe for AnimatedValue<T>
impl<T> Send for AnimatedValue<T>
impl<T> Sync for AnimatedValue<T>
impl<T> Unpin for AnimatedValue<T>
impl<T> UnsafeUnpin for AnimatedValue<T>
impl<T> UnwindSafe for AnimatedValue<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more