pub struct AnimationRuntime<C = SystemClock> { /* private fields */ }Expand description
Runtime state owned by an Iced application.
§Example
use aura_anim_iced::{
AnimationRuntime, AnimationTargetId, KeyframesBuilder, Timing, property,
};
let mut runtime = AnimationRuntime::new();
let target = AnimationTargetId::new();
let registration = runtime.register_keyframes(
target,
KeyframesBuilder::new()
.with_timing(Timing::new(100.0))
.at(0.0, (property::OPACITY, 0.0))
.at(1.0, (property::OPACITY, 1.0))
.finish(),
);
assert!(runtime.should_subscribe());Implementations§
Source§impl AnimationRuntime<TestClock>
impl AnimationRuntime<TestClock>
Source§impl<C: AnimationClock> AnimationRuntime<C>
impl<C: AnimationClock> AnimationRuntime<C>
Sourcepub fn with_clock(clock: C) -> Self
pub fn with_clock(clock: C) -> Self
Creates an empty runtime with a custom clock.
Sourcepub fn register_keyframes(
&mut self,
target: AnimationTargetId,
keyframes: Keyframes,
) -> AnimationRegistration
pub fn register_keyframes( &mut self, target: AnimationTargetId, keyframes: Keyframes, ) -> AnimationRegistration
Registers keyframes and returns their initial runtime output.
Sourcepub fn register_timeline(
&mut self,
target: AnimationTargetId,
timeline: Timeline,
) -> AnimationRegistration
pub fn register_timeline( &mut self, target: AnimationTargetId, timeline: Timeline, ) -> AnimationRegistration
Registers a timeline and returns its initial runtime output.
Sourcepub fn tick(&mut self) -> AnimationTick
pub fn tick(&mut self) -> AnimationTick
Advances active animations and returns a view-ready aggregated snapshot.
Sourcepub fn tick_into(&mut self, output: &mut AnimationTick)
pub fn tick_into(&mut self, output: &mut AnimationTick)
Advances active animations into a reusable tick output.
Sourcepub fn cancel_target(&mut self, target: AnimationTargetId)
pub fn cancel_target(&mut self, target: AnimationTargetId)
Cancels and removes all active animations registered for target.
Sourcepub fn seek_target(&mut self, target: AnimationTargetId, pos: Duration)
pub fn seek_target(&mut self, target: AnimationTargetId, pos: Duration)
Seeks all active animations registered for target.
Sourcepub fn pause_target(&mut self, target: AnimationTargetId)
pub fn pause_target(&mut self, target: AnimationTargetId)
Pauses all active animations registered for target.
Sourcepub fn cancel(
&mut self,
target: AnimationTargetId,
handle: AnimationHandle,
) -> bool
pub fn cancel( &mut self, target: AnimationTargetId, handle: AnimationHandle, ) -> bool
Cancels and removes one animation when handle belongs to target.
Returns true when an entry was removed.
Sourcepub fn seek(
&mut self,
target: AnimationTargetId,
handle: AnimationHandle,
pos: Duration,
) -> bool
pub fn seek( &mut self, target: AnimationTargetId, handle: AnimationHandle, pos: Duration, ) -> bool
Seeks one animation when handle belongs to target.
Returns true when an entry was found and updated.
Sourcepub fn pause(
&mut self,
target: AnimationTargetId,
handle: AnimationHandle,
) -> bool
pub fn pause( &mut self, target: AnimationTargetId, handle: AnimationHandle, ) -> bool
Pauses one animation when handle belongs to target.
Returns true when an entry was found and updated.
Source§impl<C> AnimationRuntime<C>
impl<C> AnimationRuntime<C>
Sourcepub const fn motion_policy(&self) -> TickPolicy
pub const fn motion_policy(&self) -> TickPolicy
Returns the current motion policy.
Sourcepub const fn set_motion_policy(&mut self, motion_policy: TickPolicy)
pub const fn set_motion_policy(&mut self, motion_policy: TickPolicy)
Replaces the current motion policy.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Returns the number of active animation entries.
Sourcepub fn should_tick(&self) -> bool
pub fn should_tick(&self) -> bool
Returns whether the runtime has entries that should receive animation ticks.
Sourcepub fn should_subscribe(&self) -> bool
pub fn should_subscribe(&self) -> bool
Returns whether an Iced subscription should keep producing animation ticks.
Trait Implementations§
Source§impl<C: Clone> Clone for AnimationRuntime<C>
impl<C: Clone> Clone for AnimationRuntime<C>
Source§fn clone(&self) -> AnimationRuntime<C>
fn clone(&self) -> AnimationRuntime<C>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<C: Debug> Debug for AnimationRuntime<C>
impl<C: Debug> Debug for AnimationRuntime<C>
Source§impl Default for AnimationRuntime<SystemClock>
impl Default for AnimationRuntime<SystemClock>
Auto Trait Implementations§
impl<C> Freeze for AnimationRuntime<C>where
C: Freeze,
impl<C> RefUnwindSafe for AnimationRuntime<C>where
C: RefUnwindSafe,
impl<C> Send for AnimationRuntime<C>where
C: Send,
impl<C> Sync for AnimationRuntime<C>where
C: Sync,
impl<C> Unpin for AnimationRuntime<C>where
C: Unpin,
impl<C> UnsafeUnpin for AnimationRuntime<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for AnimationRuntime<C>where
C: UnwindSafe,
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
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.