pub trait AnimationWithParent<T>: Sized + 'staticwhere
T: 'static,{
// Required method
fn parent(self: Handle<Self>, app: &App) -> AnyAnimation<T>;
// Provided methods
fn add_listener(self: Handle<Self>, app: &mut App, listener: Listener) { ... }
fn remove_listener(self: Handle<Self>, app: &mut App, listener: &Listener) { ... }
fn add_status_listener(
self: Handle<Self>,
app: &mut App,
listener: AnimationStatusListener,
) { ... }
fn remove_status_listener(
self: Handle<Self>,
app: &mut App,
listener: &AnimationStatusListener,
) { ... }
fn status(self: Handle<Self>, app: &App) -> AnimationStatus { ... }
}Expand description
Implements most of the animation interface by deferring its behavior to a
given parent animation.
To implement an animation that is driven by a parent, it is only necessary
to implement this trait, supply parent, and implement
Animation::value.
To define a mapping from values in the range 0..1, consider subclassing
Tween instead.
Required Methods§
Sourcefn parent(self: Handle<Self>, app: &App) -> AnyAnimation<T>
fn parent(self: Handle<Self>, app: &App) -> AnyAnimation<T>
The animation whose value this animation will proxy.
This animation must remain the same for the lifetime of this object. If
you wish to proxy a different animation at different times, consider
using ProxyAnimation.
Provided Methods§
Sourcefn add_listener(self: Handle<Self>, app: &mut App, listener: Listener)
fn add_listener(self: Handle<Self>, app: &mut App, listener: Listener)
Calls the listener every time the value of the animation changes.
Listeners can be removed with remove_listener.
Sourcefn remove_listener(self: Handle<Self>, app: &mut App, listener: &Listener)
fn remove_listener(self: Handle<Self>, app: &mut App, listener: &Listener)
Stop calling the listener every time the value of the animation changes.
Listeners can be added with add_listener.
Sourcefn add_status_listener(
self: Handle<Self>,
app: &mut App,
listener: AnimationStatusListener,
)
fn add_status_listener( self: Handle<Self>, app: &mut App, listener: AnimationStatusListener, )
Calls listener every time the status of the animation changes.
Listeners can be removed with remove_status_listener.
Sourcefn remove_status_listener(
self: Handle<Self>,
app: &mut App,
listener: &AnimationStatusListener,
)
fn remove_status_listener( self: Handle<Self>, app: &mut App, listener: &AnimationStatusListener, )
Stops calling the listener every time the status of the animation changes.
Listeners can be added with add_status_listener.
Sourcefn status(self: Handle<Self>, app: &App) -> AnimationStatus
fn status(self: Handle<Self>, app: &App) -> AnimationStatus
The current status of this animation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".