ConnectedAnimationService
struct · ferroui-controls · v0.5.0
struct ConnectedAnimationService
Coordinates connected animations across views. Each TopLevel window
has its own independent instance so animations cannot bleed across
windows.
Typical usage:
- On the source view, call
prepare_to_animateto capture the element. - Navigate to the destination view.
- On the destination view, call
get_animationthentry_starton the returned animation to run the animation.
Members
TYPEto_refget_for_top_levelget_for_current_viewdefault_durationset_default_durationdefault_easing_functionset_default_easing_functionprepare_to_animateget_animation
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<ConnectedAnimationService>
Returns a strong reference to this object.
get_for_top_level
fn get_for_top_level(top_level: &TopLevel) -> Ref<ConnectedAnimationService>
Gets the ConnectedAnimationService for the specified top_level.
Each top-level window has its own isolated instance.
get_for_current_view
fn get_for_current_view() -> Ref<ConnectedAnimationService>
GetForCurrentView: the service of the thread. Animations prepared with it can fly in
any window of the thread (each flight uses the window of its elements).
default_duration
fn default_duration(self: &Self) -> Duration
Gets the default duration applied to all animations whose configuration does not specify one. Defaults to 300 ms.
set_default_duration
fn set_default_duration(self: &Self, value: Duration)
Sets the default duration applied to all animations whose configuration does not specify one.
default_easing_function
fn default_easing_function(self: &Self) -> Option<Easing>
Gets the default easing function applied when the active
ConnectedAnimationConfiguration
does not specify one. When None a configuration-specific default
is used.
set_default_easing_function
fn set_default_easing_function(self: &Self, value: Option<Easing>)
Sets the default easing function.
prepare_to_animate
fn prepare_to_animate(self: &Self, key: &str, source: &Visual) -> Rc<ConnectedAnimation>
Captures source and registers a pending animation under key. Call
this on the source view before navigating away.
key is the unique string that pairs this call with the matching
get_animation call on the destination view;
source is the element to animate from. Returns the prepared
ConnectedAnimation.
Panics
Panics if key is empty.
get_animation
fn get_animation(self: &Self, key: &str) -> Option<Rc<ConnectedAnimation>>
Retrieves a pending animation registered under key. Returns None
if no animation exists or if it has already been consumed. Call this
on the destination view after navigating, then call
try_start on the returned
animation.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyFerroObjectImplExtClassDefaultsErasedDestructorIntoEitherDerefUpcast<T>Upcast<ConnectedAnimationService>StaticTypeObjectTypeSubclassable<T>FerroObjectImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.