pub struct Progress { /* private fields */ }Expand description
A 0-to-1 progress value for widget state (hover, press, focus, toggle), animated by the runtime.
Start a transition with Progress::animate and read the value for the
frame being painted with Progress::get. The runtime repaints the widget
until the transition ends, so the widget needs no animation-frame
handling. Transitions follow the app’s MotionPolicy and keep momentum
when retargeted.
Implementations§
Source§impl Progress
impl Progress
pub const EPSILON: f32 = 1e-4
pub const fn new(value: f32) -> Progress
Sourcepub const fn movement(self) -> Progress
pub const fn movement(self) -> Progress
Mark this as movement (a sliding indicator, for example): reduced motion finishes it immediately.
Sourcepub const fn invalidating(self, kind: InvalidationKind) -> Progress
pub const fn invalidating(self, kind: InvalidationKind) -> Progress
Invalidate kind instead of paint while animating, such as
Transform or Effect for progress read in layer properties.
Sourcepub fn get(&self, clock: &impl FrameClock) -> f32
pub fn get(&self, clock: &impl FrameClock) -> f32
The value at the time of the frame clock is producing.
pub fn target(&self) -> f32
pub fn is_animating(&self, clock: &impl FrameClock) -> bool
Sourcepub fn is_presented(&self, clock: &impl FrameClock) -> bool
pub fn is_presented(&self, clock: &impl FrameClock) -> bool
Whether anything shows at clock’s frame: the value is above zero,
heading above zero, or still animating.
Sourcepub fn animate(
&mut self,
target: f32,
spec: AnimationSpec,
ctx: &mut impl AnimateCtx,
) -> bool
pub fn animate( &mut self, target: f32, spec: AnimationSpec, ctx: &mut impl AnimateCtx, ) -> bool
Animate toward target (clamped to 0..=1) with spec. Returns
whether a transition started.
Sourcepub fn animate_after(
&mut self,
target: f32,
delay: f64,
spec: AnimationSpec,
ctx: &mut impl AnimateCtx,
) -> bool
pub fn animate_after( &mut self, target: f32, delay: f64, spec: AnimationSpec, ctx: &mut impl AnimateCtx, ) -> bool
Like Progress::animate, starting delay seconds from now.
Trait Implementations§
impl Copy for Progress
impl StructuralPartialEq for Progress
Auto Trait Implementations§
impl Forget for Progress
impl Freeze for Progress
impl Move for Progress
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
impl UnwindSafe for Progress
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> 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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.