pub trait Animation<T>: Sized + 'staticwhere
T: 'static,{
Show 13 methods
// Required 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;
fn value(self: Handle<Self>, app: &App) -> T;
// Provided methods
fn is_dismissed(self: Handle<Self>, app: &App) -> bool { ... }
fn is_completed(self: Handle<Self>, app: &App) -> bool { ... }
fn is_animating(self: Handle<Self>, app: &App) -> bool { ... }
fn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool { ... }
fn to_string_details(self: Handle<Self>, app: &App) -> String { ... }
fn to_string(self: Handle<Self>, app: &App) -> String { ... }
fn as_animation(self: Handle<Self>) -> AnyAnimation<T> { ... }
}Expand description
A value which might change over time, moving forward or backward.
This is what a concrete animation implements — Dart’s
class X extends Animation<T>. A field or parameter Dart types as
Animation<T> holds the erased AnimationRef<T> instead; get one from a
Ref with Retained::erase, and the bare AnyAnimation<T>
that names it without keeping it from as_animation.
The members take self: Handle<Self> rather than &self, for the reason
recorded on the listener_helpers traits: a &self receiver would borrow
this animation’s slot for the whole call, and the listener members hand
&mut App onward to reach other objects and run listeners.
Required 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.
Provided Methods§
Sourcefn is_dismissed(self: Handle<Self>, app: &App) -> bool
fn is_dismissed(self: Handle<Self>, app: &App) -> bool
Whether this animation is stopped at the beginning.
Sourcefn is_completed(self: Handle<Self>, app: &App) -> bool
fn is_completed(self: Handle<Self>, app: &App) -> bool
Whether this animation is stopped at the end.
Sourcefn is_animating(self: Handle<Self>, app: &App) -> bool
fn is_animating(self: Handle<Self>, app: &App) -> bool
Whether this animation is running in either direction.
Sourcefn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool
fn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool
Whether the current aim of this animation is toward completion.
Sourcefn to_string_details(self: Handle<Self>, app: &App) -> String
fn to_string_details(self: Handle<Self>, app: &App) -> String
Dart’s Animation.toStringDetails: the status as its arrow.
Sourcefn to_string(self: Handle<Self>, app: &App) -> String
fn to_string(self: Handle<Self>, app: &App) -> String
Dart’s Animation.toString: the identity and toStringDetails.
Sourcefn as_animation(self: Handle<Self>) -> AnyAnimation<T>
fn as_animation(self: Handle<Self>) -> AnyAnimation<T>
This animation as the erased AnyAnimation<T> — what to pass where
a Dart API takes an Animation<T>.
The object is untouched; this mints an erased second handle to it, so
concrete members stay reachable through the typed one while the erased
handle sits in a field Dart types as Animation<T>.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".