pub struct Animation {
pub(crate) start: Duration,
pub(crate) duration: Duration,
pub(crate) curve: Curve,
}Expand description
One animation: when it started, how long it takes, and how it moves.
Deliberately holds no value of its own. It reports progress, and the caller interpolates whatever it is animating — a rectangle, an opacity, a colour. That is what lets one engine drive window geometry in the compositor and a box in a preview page without knowing about either.
Fields§
§start: Duration§duration: Duration§curve: CurveImplementations§
Source§impl Animation
impl Animation
pub fn new(start: Duration, duration: Duration, curve: Curve) -> Self
pub fn duration(&self) -> Duration
pub fn curve(&self) -> Curve
Sourcepub fn progress(&self, now: Duration) -> f64
pub fn progress(&self, now: Duration) -> f64
How far along it is, which is not the same as how much time has passed.
pub fn done(&self, now: Duration) -> bool
Trait Implementations§
impl Copy for Animation
impl StructuralPartialEq for Animation
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl Send for Animation
impl Sync for Animation
impl Unpin for Animation
impl UnsafeUnpin for Animation
impl UnwindSafe for Animation
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