pub struct Transition {
pub duration: f32,
pub delay: f32,
pub easing: Easing,
}Expand description
A property transition: an Easing applied over duration after delay.
Fields§
§duration: f32Animation duration in seconds (> 0).
delay: f32Delay before the animation begins, in seconds (>= 0).
easing: EasingThe timing function.
Implementations§
Source§impl Transition
impl Transition
Sourcepub fn new(duration: f32, easing: Easing) -> Self
pub fn new(duration: f32, easing: Easing) -> Self
A transition over duration seconds with the given easing and no delay.
Sourcepub fn with_delay(self, delay: f32) -> Self
pub fn with_delay(self, delay: f32) -> Self
Builder: set the start delay.
Sourcepub fn progress(&self, elapsed: f32) -> f32
pub fn progress(&self, elapsed: f32) -> f32
The eased progress [0, 1] at elapsed seconds since the transition was
scheduled (accounts for delay). Returns 0 during the delay and 1
once delay + duration has passed.
Sourcepub fn sample(&self, start: f32, end: f32, elapsed: f32) -> f32
pub fn sample(&self, start: f32, end: f32, elapsed: f32) -> f32
Interpolate a scalar from start to end at elapsed seconds.
Sourcepub fn is_finished(&self, elapsed: f32) -> bool
pub fn is_finished(&self, elapsed: f32) -> bool
Returns true once the transition (delay + duration) has completed.
Trait Implementations§
Source§impl Clone for Transition
impl Clone for Transition
Source§fn clone(&self) -> Transition
fn clone(&self) -> Transition
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 moreSource§impl Debug for Transition
impl Debug for Transition
Source§impl PartialEq for Transition
impl PartialEq for Transition
Source§fn eq(&self, other: &Transition) -> bool
fn eq(&self, other: &Transition) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for Transition
impl StructuralPartialEq for Transition
Auto Trait Implementations§
impl Freeze for Transition
impl RefUnwindSafe for Transition
impl Send for Transition
impl Sync for Transition
impl Unpin for Transition
impl UnsafeUnpin for Transition
impl UnwindSafe for Transition
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