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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.