pub struct TransitionState<T> { /* private fields */ }Expand description
Caller-owned state for one target-value transition, independent of mounting.
Keyed state lives only while its element renders, so a virtualized row that
scrolls out and back restarts at its target. Keep a TransitionState with the
row’s data instead and sample it while rendering:
let opacity = row.highlight.sample(target, policy, window, cx).value;Clones share its clock and interruption/reversal history. The first sample
adopts its target immediately; later samples use the same algorithm as
transition_with_status. No view or window is retained. A new handle
resets it.
Implementations§
Source§impl<T: Interpolate + PartialEq + 'static> TransitionState<T>
impl<T: Interpolate + PartialEq + 'static> TransitionState<T>
Sourcepub fn sample(
&self,
target: T,
policy: Transition,
window: &mut Window,
cx: &mut App,
) -> MotionValue<T>
pub fn sample( &self, target: T, policy: Transition, window: &mut Window, cx: &mut App, ) -> MotionValue<T>
Returns the current value toward target, as transition_with_status
does, and requests the next animation frame while the status is
Delayed or Running.
Call this while rendering an element. A target that changes while the element is not rendered starts transitioning at the next sample.
Trait Implementations§
Source§impl<T: Clone> Clone for TransitionState<T>
impl<T: Clone> Clone for TransitionState<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TransitionState<T>
impl<T> !Send for TransitionState<T>
impl<T> !Sync for TransitionState<T>
impl<T> !UnwindSafe for TransitionState<T>
impl<T> Forget for TransitionState<T>
impl<T> Freeze for TransitionState<T>
impl<T> Unpin for TransitionState<T>
impl<T> UnsafeUnpin for TransitionState<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
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().