pub struct AnimationController {
pub lower_bound: f64,
pub upper_bound: f64,
pub animation_behavior: AnimationBehavior,
pub duration: Option<Duration>,
pub reverse_duration: Option<Duration>,
/* private fields */
}Expand description
A controller for an animation.
This class lets you perform tasks such as:
- Play an animation forward or in reverse, or stop an animation.
- Set the animation to a specific value.
- Define the upper and lower bounds of an animation.
- Create a fling animation effect using a physics simulation.
By default, an AnimationController linearly produces values that range
from 0.0 to 1.0, during a given duration.
An AnimationController needs a TickerProvider, Dart’s vsync
constructor argument.
Fields§
§lower_bound: f64The value at which this animation is deemed to be dismissed.
upper_bound: f64The value at which this animation is deemed to be completed.
animation_behavior: AnimationBehaviorThe behavior of the controller when accessibility features disable animations.
duration: Option<Duration>The length of time this animation should last.
If reverse_duration is
specified, then duration is only
used when going forward. Otherwise, it specifies the duration going in
both directions.
reverse_duration: Option<Duration>The length of time this animation should last when going in reverse.
The value of duration is used if
this is None.
Implementations§
Source§impl AnimationController
impl AnimationController
Sourcepub fn to_string(self: Handle<AnimationController>, app: &App) -> String
pub fn to_string(self: Handle<AnimationController>, app: &App) -> String
Dart’s AnimationController.toString, which it inherits from Animation.
Sourcepub fn new(
app: &mut App,
value: Option<f64>,
duration: Option<Duration>,
reverse_duration: Option<Duration>,
lower_bound: f64,
upper_bound: f64,
animation_behavior: AnimationBehavior,
vsync: impl TickerProvider,
) -> Retained<Handle<AnimationController>>
pub fn new( app: &mut App, value: Option<f64>, duration: Option<Duration>, reverse_duration: Option<Duration>, lower_bound: f64, upper_bound: f64, animation_behavior: AnimationBehavior, vsync: impl TickerProvider, ) -> Retained<Handle<AnimationController>>
Creates an animation controller.
value is the initial value of the animation; None means
lower_bound. vsync is the required TickerProvider. Dart’s
defaults: lower_bound 0.0, upper_bound 1.0, animation_behavior
Normal; debugLabel is not ported.
Dart’s constructor registers the _tick tear-off with the vended
ticker, so creation goes through the App.
Sourcepub fn unbounded(
app: &mut App,
value: f64,
duration: Option<Duration>,
reverse_duration: Option<Duration>,
animation_behavior: AnimationBehavior,
vsync: impl TickerProvider,
) -> Retained<Handle<AnimationController>>
pub fn unbounded( app: &mut App, value: f64, duration: Option<Duration>, reverse_duration: Option<Duration>, animation_behavior: AnimationBehavior, vsync: impl TickerProvider, ) -> Retained<Handle<AnimationController>>
Creates an animation controller with no upper or lower bound for its value.
Dart’s defaults: value 0.0, animation_behavior Preserve.
Sourcepub fn value(self: Handle<AnimationController>, app: &App) -> f64
pub fn value(self: Handle<AnimationController>, app: &App) -> f64
The current value of the animation.
Sourcepub fn status(self: Handle<AnimationController>, app: &App) -> AnimationStatus
pub fn status(self: Handle<AnimationController>, app: &App) -> AnimationStatus
The current status of this animation.
Sourcepub fn last_elapsed_duration(
self: Handle<AnimationController>,
app: &App,
) -> Option<Duration>
pub fn last_elapsed_duration( self: Handle<AnimationController>, app: &App, ) -> Option<Duration>
The amount of time that has passed between the time the animation started and the most recent tick of the animation.
If the controller is not animating, the last elapsed duration is
None.
Source§impl AnimationController
impl AnimationController
Sourcepub fn view(self: Handle<AnimationController>) -> AnyAnimation<f64>
pub fn view(self: Handle<AnimationController>) -> AnyAnimation<f64>
An AnyAnimation<f64> view of this controller — what to pass where a
Dart API wants an Animation<double>. Dart’s view getter returns
this; the erased handle is that upcast.
Sourcepub fn resync(
self: Handle<AnimationController>,
app: &mut App,
vsync: impl TickerProvider,
)
pub fn resync( self: Handle<AnimationController>, app: &mut App, vsync: impl TickerProvider, )
Recreates the Ticker with the new TickerProvider.
Sourcepub fn set_value(
self: Handle<AnimationController>,
app: &mut App,
new_value: f64,
)
pub fn set_value( self: Handle<AnimationController>, app: &mut App, new_value: f64, )
Stops the animation controller and sets the current value of the animation.
Sourcepub fn reset(self: Handle<AnimationController>, app: &mut App)
pub fn reset(self: Handle<AnimationController>, app: &mut App)
Sets the controller’s value to the lower bound, stopping the animation.
Sourcepub fn velocity(self: Handle<AnimationController>, app: &mut App) -> f64
pub fn velocity(self: Handle<AnimationController>, app: &mut App) -> f64
The rate of change of AnimationController::value per second.
Sourcepub fn is_animating(self: Handle<AnimationController>, app: &mut App) -> bool
pub fn is_animating(self: Handle<AnimationController>, app: &mut App) -> bool
Whether this animation is currently animating in either the forward or reverse direction.
Sourcepub fn forward(
self: Handle<AnimationController>,
app: &mut App,
from: Option<f64>,
) -> TickerFuture ⓘ
pub fn forward( self: Handle<AnimationController>, app: &mut App, from: Option<f64>, ) -> TickerFuture ⓘ
Starts running this animation forwards (towards the end).
Sourcepub fn reverse(
self: Handle<AnimationController>,
app: &mut App,
from: Option<f64>,
) -> TickerFuture ⓘ
pub fn reverse( self: Handle<AnimationController>, app: &mut App, from: Option<f64>, ) -> TickerFuture ⓘ
Starts running this animation in reverse (towards the beginning).
Sourcepub fn toggle(
self: Handle<AnimationController>,
app: &mut App,
from: Option<f64>,
) -> TickerFuture ⓘ
pub fn toggle( self: Handle<AnimationController>, app: &mut App, from: Option<f64>, ) -> TickerFuture ⓘ
Toggles the direction of this animation.
Sourcepub fn animate_to(
self: Handle<AnimationController>,
app: &mut App,
target: f64,
duration: Option<Duration>,
curve: Rc<dyn Curve>,
) -> TickerFuture ⓘ
pub fn animate_to( self: Handle<AnimationController>, app: &mut App, target: f64, duration: Option<Duration>, curve: Rc<dyn Curve>, ) -> TickerFuture ⓘ
Drives the animation from its current value to target.
Sourcepub fn animate_back(
self: Handle<AnimationController>,
app: &mut App,
target: f64,
duration: Option<Duration>,
curve: Rc<dyn Curve>,
) -> TickerFuture ⓘ
pub fn animate_back( self: Handle<AnimationController>, app: &mut App, target: f64, duration: Option<Duration>, curve: Rc<dyn Curve>, ) -> TickerFuture ⓘ
Drives the animation from its current value to target, going in reverse.
Sourcepub fn repeat(
self: Handle<AnimationController>,
app: &mut App,
min: Option<f64>,
max: Option<f64>,
reverse: bool,
period: Option<Duration>,
count: Option<u64>,
) -> TickerFuture ⓘ
pub fn repeat( self: Handle<AnimationController>, app: &mut App, min: Option<f64>, max: Option<f64>, reverse: bool, period: Option<Duration>, count: Option<u64>, ) -> TickerFuture ⓘ
Starts running this animation in the forward direction, and restarts the animation when it completes.
Sourcepub fn fling(
self: Handle<AnimationController>,
app: &mut App,
velocity: f64,
spring_description: Option<SpringDescription>,
animation_behavior: Option<AnimationBehavior>,
) -> TickerFuture ⓘ
pub fn fling( self: Handle<AnimationController>, app: &mut App, velocity: f64, spring_description: Option<SpringDescription>, animation_behavior: Option<AnimationBehavior>, ) -> TickerFuture ⓘ
Drives the animation with a spring and initial velocity.
Sourcepub fn animate_with(
self: Handle<AnimationController>,
app: &mut App,
simulation: Box<dyn Simulation>,
) -> TickerFuture ⓘ
pub fn animate_with( self: Handle<AnimationController>, app: &mut App, simulation: Box<dyn Simulation>, ) -> TickerFuture ⓘ
Drives the animation according to the given simulation.
Sourcepub fn animate_back_with(
self: Handle<AnimationController>,
app: &mut App,
simulation: Box<dyn Simulation>,
) -> TickerFuture ⓘ
pub fn animate_back_with( self: Handle<AnimationController>, app: &mut App, simulation: Box<dyn Simulation>, ) -> TickerFuture ⓘ
Like animate_with, but the status
is reported as AnimationStatus::Reverse.
Sourcepub fn stop(self: Handle<AnimationController>, app: &mut App, canceled: bool)
pub fn stop(self: Handle<AnimationController>, app: &mut App, canceled: bool)
Stops running this animation.
Sourcepub fn dispose(self: Handle<AnimationController>, app: &mut App)
pub fn dispose(self: Handle<AnimationController>, app: &mut App)
Release the resources used by this object. The object is no longer usable after this method is called.
Trait Implementations§
Source§impl Animation<f64> for AnimationController
impl Animation<f64> for AnimationController
Source§fn add_listener(
self: Handle<AnimationController>,
app: &mut App,
listener: Listener,
)
fn add_listener( self: Handle<AnimationController>, app: &mut App, listener: Listener, )
Source§fn remove_listener(
self: Handle<AnimationController>,
app: &mut App,
listener: &Listener,
)
fn remove_listener( self: Handle<AnimationController>, app: &mut App, listener: &Listener, )
Source§fn add_status_listener(
self: Handle<AnimationController>,
app: &mut App,
listener: AnimationStatusListener,
)
fn add_status_listener( self: Handle<AnimationController>, app: &mut App, listener: AnimationStatusListener, )
Source§fn remove_status_listener(
self: Handle<AnimationController>,
app: &mut App,
listener: &AnimationStatusListener,
)
fn remove_status_listener( self: Handle<AnimationController>, app: &mut App, listener: &AnimationStatusListener, )
Source§fn status(self: Handle<AnimationController>, app: &App) -> AnimationStatus
fn status(self: Handle<AnimationController>, app: &App) -> AnimationStatus
Source§fn value(self: Handle<AnimationController>, app: &App) -> f64
fn value(self: Handle<AnimationController>, app: &App) -> f64
Source§fn to_string_details(self: Handle<AnimationController>, app: &App) -> String
fn to_string_details(self: Handle<AnimationController>, app: &App) -> String
Animation.toStringDetails: the status as its arrow.Source§fn is_animating(self: Handle<AnimationController>, app: &App) -> bool
fn is_animating(self: Handle<AnimationController>, app: &App) -> bool
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_forward_or_completed(self: Handle<Self>, app: &App) -> bool
fn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool
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 AnimationController
impl AnimationEagerListenerMixin for AnimationController
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 AnimationController
impl AnimationLocalListenersMixin for AnimationController
Source§fn local_listeners_data(
self: Handle<AnimationController>,
app: &App,
) -> &AnimationLocalListenersData
fn local_listeners_data( self: Handle<AnimationController>, app: &App, ) -> &AnimationLocalListenersData
Source§fn local_listeners_data_mut(
self: Handle<AnimationController>,
app: &mut App,
) -> &mut AnimationLocalListenersData
fn local_listeners_data_mut( self: Handle<AnimationController>, app: &mut App, ) -> &mut AnimationLocalListenersData
Source§fn did_register_listener(self: Handle<AnimationController>, app: &mut App)
fn did_register_listener(self: Handle<AnimationController>, app: &mut App)
add_listener. Read moreSource§fn did_unregister_listener(self: Handle<AnimationController>, app: &mut App)
fn did_unregister_listener(self: Handle<AnimationController>, 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 AnimationController
impl AnimationLocalStatusListenersMixin for AnimationController
Source§fn local_status_listeners_data(
self: Handle<AnimationController>,
app: &App,
) -> &AnimationLocalStatusListenersData
fn local_status_listeners_data( self: Handle<AnimationController>, app: &App, ) -> &AnimationLocalStatusListenersData
Source§fn local_status_listeners_data_mut(
self: Handle<AnimationController>,
app: &mut App,
) -> &mut AnimationLocalStatusListenersData
fn local_status_listeners_data_mut( self: Handle<AnimationController>, app: &mut App, ) -> &mut AnimationLocalStatusListenersData
Source§fn did_register_listener(self: Handle<AnimationController>, app: &mut App)
fn did_register_listener(self: Handle<AnimationController>, app: &mut App)
add_status_listener. Read moreSource§fn did_unregister_listener(self: Handle<AnimationController>, app: &mut App)
fn did_unregister_listener(self: Handle<AnimationController>, 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