pub struct TrainHoppingAnimation {
pub on_switched_train: Option<Listener>,
/* private fields */
}Expand description
This animation starts by proxying one animation, but when the value of that animation crosses the value of the second (either because the second is going in the opposite direction, or because the one overtakes the other), the animation hops over to proxying the second animation.
When the TrainHoppingAnimation starts proxying the second animation
instead of the first, the on_switched_train callback is called.
If the two animations start at the same value, then the
TrainHoppingAnimation immediately hops to the second animation, and the
on_switched_train callback is not called. If only one animation is
provided (i.e. if the second is None), then the TrainHoppingAnimation
just proxies the first animation.
Since this object must track the two animations even when it has no
listeners of its own, instead of shutting down when all its listeners are
removed, it exposes a dispose method. Call this method to shut this
object down.
Fields§
§on_switched_train: Option<Listener>Called when this animation switches to be driven by the second animation.
This is not called if the two animations provided to the constructor have the same value at the time of the call to the constructor. In that case, the second animation is used from the start, and the first is ignored.
Implementations§
Source§impl TrainHoppingAnimation
impl TrainHoppingAnimation
Sourcepub fn new(
app: &mut App,
current_train: Retained<AnyAnimation<f64>>,
next_train: Option<Retained<AnyAnimation<f64>>>,
on_switched_train: Option<Listener>,
) -> Retained<Handle<TrainHoppingAnimation>>
pub fn new( app: &mut App, current_train: Retained<AnyAnimation<f64>>, next_train: Option<Retained<AnyAnimation<f64>>>, on_switched_train: Option<Listener>, ) -> Retained<Handle<TrainHoppingAnimation>>
Creates a train-hopping animation.
If the next train is None, then this object will just proxy the first
animation and never hop. Dart’s constructor registers tear-offs of the
object under construction, so creation goes through the App.
Sourcepub fn current_train(&self) -> Option<AnyAnimation<f64>>
pub fn current_train(&self) -> Option<AnyAnimation<f64>>
The animation that is currently driving this animation.
The identity of this object will change from the first animation to the
second animation when on_switched_train is called.
Sourcepub fn dispose(self: Handle<TrainHoppingAnimation>, app: &mut App)
pub fn dispose(self: Handle<TrainHoppingAnimation>, app: &mut App)
Frees all the resources used by this performance. After this is called, this object is no longer usable.
Trait Implementations§
Source§impl Animation<f64> for TrainHoppingAnimation
impl Animation<f64> for TrainHoppingAnimation
Source§fn add_listener(
self: Handle<TrainHoppingAnimation>,
app: &mut App,
listener: Listener,
)
fn add_listener( self: Handle<TrainHoppingAnimation>, app: &mut App, listener: Listener, )
Source§fn remove_listener(
self: Handle<TrainHoppingAnimation>,
app: &mut App,
listener: &Listener,
)
fn remove_listener( self: Handle<TrainHoppingAnimation>, app: &mut App, listener: &Listener, )
Source§fn add_status_listener(
self: Handle<TrainHoppingAnimation>,
app: &mut App,
listener: AnimationStatusListener,
)
fn add_status_listener( self: Handle<TrainHoppingAnimation>, app: &mut App, listener: AnimationStatusListener, )
Source§fn remove_status_listener(
self: Handle<TrainHoppingAnimation>,
app: &mut App,
listener: &AnimationStatusListener,
)
fn remove_status_listener( self: Handle<TrainHoppingAnimation>, app: &mut App, listener: &AnimationStatusListener, )
Source§fn status(self: Handle<TrainHoppingAnimation>, app: &App) -> AnimationStatus
fn status(self: Handle<TrainHoppingAnimation>, app: &App) -> AnimationStatus
Source§fn value(self: Handle<TrainHoppingAnimation>, app: &App) -> f64
fn value(self: Handle<TrainHoppingAnimation>, app: &App) -> f64
Source§fn is_dismissed(self: Handle<Self>, app: &App) -> bool
fn is_dismissed(self: Handle<Self>, app: &App) -> bool
Source§fn is_completed(self: Handle<Self>, app: &App) -> bool
fn is_completed(self: Handle<Self>, app: &App) -> bool
Source§fn is_animating(self: Handle<Self>, app: &App) -> bool
fn is_animating(self: Handle<Self>, app: &App) -> bool
Source§fn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool
fn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool
Source§fn to_string_details(self: Handle<Self>, app: &App) -> String
fn to_string_details(self: Handle<Self>, app: &App) -> String
Animation.toStringDetails: the status as its arrow.Source§fn to_string(self: Handle<Self>, app: &App) -> String
fn to_string(self: Handle<Self>, app: &App) -> String
Animation.toString: the identity and toStringDetails.Source§fn as_animation(self: Handle<Self>) -> AnyAnimation<T>
fn as_animation(self: Handle<Self>) -> AnyAnimation<T>
AnyAnimation<T> — what to pass where
a Dart API takes an Animation<T>. Read moreSource§impl AnimationEagerListenerMixin for TrainHoppingAnimation
impl AnimationEagerListenerMixin for TrainHoppingAnimation
Source§fn did_register_listener(self: Handle<Self>, _app: &mut App)
fn did_register_listener(self: Handle<Self>, _app: &mut App)
Source§fn did_unregister_listener(self: Handle<Self>, _app: &mut App)
fn did_unregister_listener(self: Handle<Self>, _app: &mut App)
Source§impl AnimationLocalListenersMixin for TrainHoppingAnimation
impl AnimationLocalListenersMixin for TrainHoppingAnimation
Source§fn local_listeners_data(
self: Handle<TrainHoppingAnimation>,
app: &App,
) -> &AnimationLocalListenersData
fn local_listeners_data( self: Handle<TrainHoppingAnimation>, app: &App, ) -> &AnimationLocalListenersData
Source§fn local_listeners_data_mut(
self: Handle<TrainHoppingAnimation>,
app: &mut App,
) -> &mut AnimationLocalListenersData
fn local_listeners_data_mut( self: Handle<TrainHoppingAnimation>, app: &mut App, ) -> &mut AnimationLocalListenersData
Source§fn did_register_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
fn did_register_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
add_listener. Read moreSource§fn did_unregister_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
fn did_unregister_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
remove_listener. Read moreSource§fn add_listener(self: Handle<Self>, app: &mut App, listener: Listener)
fn add_listener(self: Handle<Self>, app: &mut App, listener: Listener)
Source§fn remove_listener(self: Handle<Self>, app: &mut App, listener: &Listener)
fn remove_listener(self: Handle<Self>, app: &mut App, listener: &Listener)
Source§fn clear_listeners(self: Handle<Self>, app: &mut App)
fn clear_listeners(self: Handle<Self>, app: &mut App)
add_listener. Read moreSource§impl AnimationLocalStatusListenersMixin for TrainHoppingAnimation
impl AnimationLocalStatusListenersMixin for TrainHoppingAnimation
Source§fn local_status_listeners_data(
self: Handle<TrainHoppingAnimation>,
app: &App,
) -> &AnimationLocalStatusListenersData
fn local_status_listeners_data( self: Handle<TrainHoppingAnimation>, app: &App, ) -> &AnimationLocalStatusListenersData
Source§fn local_status_listeners_data_mut(
self: Handle<TrainHoppingAnimation>,
app: &mut App,
) -> &mut AnimationLocalStatusListenersData
fn local_status_listeners_data_mut( self: Handle<TrainHoppingAnimation>, app: &mut App, ) -> &mut AnimationLocalStatusListenersData
Source§fn did_register_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
fn did_register_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
add_status_listener. Read moreSource§fn did_unregister_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
fn did_unregister_listener(self: Handle<TrainHoppingAnimation>, app: &mut App)
remove_status_listener. Read moreSource§fn add_status_listener(
self: Handle<Self>,
app: &mut App,
listener: AnimationStatusListener,
)
fn add_status_listener( self: Handle<Self>, app: &mut App, listener: AnimationStatusListener, )
Source§fn remove_status_listener(
self: Handle<Self>,
app: &mut App,
listener: &AnimationStatusListener,
)
fn remove_status_listener( self: Handle<Self>, app: &mut App, listener: &AnimationStatusListener, )
Source§fn clear_status_listeners(self: Handle<Self>, app: &mut App)
fn clear_status_listeners(self: Handle<Self>, app: &mut App)
add_status_listener. Read more