pub enum AnimationSpec {
Tween {
duration: f64,
easing: Easing,
},
Spring(SpringSpec),
}Expand description
How a value travels to a new target: a timed curve or a spring.
Variants§
Tween
Follow easing for duration seconds.
Spring(SpringSpec)
Move like a spring released from rest; see SpringSpec.
Implementations§
Source§impl AnimationSpec
impl AnimationSpec
Sourcepub const INSTANT: AnimationSpec
pub const INSTANT: AnimationSpec
Jump straight to the target.
pub const fn tween(duration: f64, easing: Easing) -> AnimationSpec
pub const fn spring(spec: SpringSpec) -> AnimationSpec
Sourcepub fn duration(self) -> f64
pub fn duration(self) -> f64
Seconds until the value arrives: the tween’s duration, or how long the spring takes to settle.
Sourcepub fn is_instant(self) -> bool
pub fn is_instant(self) -> bool
Whether the animation finishes immediately.
Sourcepub fn progress(self, elapsed: f64) -> f32
pub fn progress(self, elapsed: f64) -> f32
Progress toward the target after elapsed seconds: 0 at the start and
exactly 1 once complete. Springs may overshoot past 1 on the way.
pub fn is_complete(self, elapsed: f64) -> bool
Sourcepub fn time_scaled(self, time_scale: f32) -> AnimationSpec
pub fn time_scaled(self, time_scale: f32) -> AnimationSpec
The same motion played at time_scale speed: 0.5 takes twice as long.
Sourcepub fn with_policy(self, policy: MotionPolicy) -> AnimationSpec
pub fn with_policy(self, policy: MotionPolicy) -> AnimationSpec
The motion to play under policy: instant when motion is off,
stretched by the policy’s time scale otherwise.
Sourcepub fn with_movement_policy(self, policy: MotionPolicy) -> AnimationSpec
pub fn with_movement_policy(self, policy: MotionPolicy) -> AnimationSpec
Like AnimationSpec::with_policy, for motion that moves content:
instant unless the policy allows movement.
Trait Implementations§
Source§impl Clone for AnimationSpec
impl Clone for AnimationSpec
Source§fn clone(&self) -> AnimationSpec
fn clone(&self) -> AnimationSpec
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 Copy for AnimationSpec
Source§impl Debug for AnimationSpec
impl Debug for AnimationSpec
Source§impl From<SpringSpec> for AnimationSpec
impl From<SpringSpec> for AnimationSpec
Source§fn from(spring: SpringSpec) -> AnimationSpec
fn from(spring: SpringSpec) -> AnimationSpec
Converts to this type from the input type.
Source§impl PartialEq for AnimationSpec
impl PartialEq for AnimationSpec
impl StructuralPartialEq for AnimationSpec
Auto Trait Implementations§
impl Forget for AnimationSpec
impl Freeze for AnimationSpec
impl Move for AnimationSpec
impl RefUnwindSafe for AnimationSpec
impl Send for AnimationSpec
impl Sync for AnimationSpec
impl Unpin for AnimationSpec
impl UnsafeUnpin for AnimationSpec
impl UnwindSafe for AnimationSpec
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.