pub struct Presence { /* private fields */ }Expand description
An element’s arrival and departure, either of which can be cancelled by the other while it is still running.
A cancelled phase is played backwards from where it had got to rather than
restarted. The two phases are separate specifications with separate
durations and separate curves, so “where it had got to” is a position and
not a time: the visible progress is looked up in the other specification —
MotionSpec::time_at — and the reversal starts from the point that
produces it. An entrance cancelled at 30% therefore leaves from 30%,
through the exit’s own curve, in the part of the exit’s time that is left
once 70% of it is already behind.
This is deliberately not the velocity handover
Transition performs on a retarget. A value aimed
somewhere new is still going the way it was going; a phase that is
cancelled has been told to go back, and carrying the speed across would
mean an element on its way in overshooting past being present, which is not
a state a lifecycle has.
Implementations§
Source§impl Presence
impl Presence
Starts hidden, so the first Presence::show animates in.
Sourcepub fn visible(enter: MotionSpec, exit: MotionSpec) -> Self
pub fn visible(enter: MotionSpec, exit: MotionSpec) -> Self
Starts fully present, for content that exists before the first frame.
pub fn phase(&self) -> Phase
Sourcepub fn is_rendered(&self) -> bool
pub fn is_rendered(&self) -> bool
True while the caller must keep the element in the tree, including for the whole exit animation.
pub fn is_animating(&self) -> bool
pub fn hide(&mut self)
pub fn toggle(&mut self)
pub fn advance(&mut self, delta: Duration)
Trait Implementations§
impl Copy for Presence
impl StructuralPartialEq for Presence
Auto Trait Implementations§
impl Freeze for Presence
impl RefUnwindSafe for Presence
impl Send for Presence
impl Sync for Presence
impl Unpin for Presence
impl UnsafeUnpin for Presence
impl UnwindSafe for Presence
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
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more