pub struct CurvedAnimation {
pub curve: Rc<dyn Curve>,
pub reverse_curve: Option<Rc<dyn Curve>>,
pub is_disposed: bool,
/* private fields */
}Expand description
An animation that applies a curve to another animation.
CurvedAnimation is useful when you want to apply a non-linear Curve
to an animation object, especially if you want different curves when the
animation is going forward vs when it is going backward.
Depending on the given curve, the output of the CurvedAnimation could
have a wider range than its input. For example, elastic curves such as
Curves::elastic_in() will significantly overshoot or undershoot the
default range of 0.0 to 1.0.
A CurvedAnimation should be disposed when no longer needed to clean up
any listeners that it may have added.
Fields§
§curve: Rc<dyn Curve>The curve to use in the forward direction.
reverse_curve: Option<Rc<dyn Curve>>The curve to use in the reverse direction.
If the parent animation changes direction without first reaching the
AnimationStatus::Completed or AnimationStatus::Dismissed
status, the CurvedAnimation stays on the same curve (albeit in the
opposite direction) to avoid visual discontinuities.
If this field is None, uses curve in both
directions.
is_disposed: boolTrue if this CurvedAnimation has been disposed.
Implementations§
Source§impl CurvedAnimation
impl CurvedAnimation
Sourcepub fn new(
app: &mut App,
parent: Retained<AnyAnimation<f64>>,
curve: Rc<dyn Curve>,
reverse_curve: Option<Rc<dyn Curve>>,
) -> Retained<Handle<CurvedAnimation>>
pub fn new( app: &mut App, parent: Retained<AnyAnimation<f64>>, curve: Rc<dyn Curve>, reverse_curve: Option<Rc<dyn Curve>>, ) -> Retained<Handle<CurvedAnimation>>
Creates a curved animation.
Dart’s constructor registers _updateCurveDirection on parent — a
tear-off of the object under construction — so creation goes through
the App: the entity exists first, then the constructor body runs in
Dart’s statement order.
Sourcepub fn dispose(self: Handle<CurvedAnimation>, app: &mut App)
pub fn dispose(self: Handle<CurvedAnimation>, app: &mut App)
Cleans up any listeners added by this CurvedAnimation.
Trait Implementations§
Source§impl Animation<f64> for CurvedAnimation
impl Animation<f64> for CurvedAnimation
Source§fn add_listener(
self: Handle<CurvedAnimation>,
app: &mut App,
listener: Listener,
)
fn add_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: Listener, )
Source§fn remove_listener(
self: Handle<CurvedAnimation>,
app: &mut App,
listener: &Listener,
)
fn remove_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: &Listener, )
Source§fn add_status_listener(
self: Handle<CurvedAnimation>,
app: &mut App,
listener: AnimationStatusListener,
)
fn add_status_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: AnimationStatusListener, )
Source§fn remove_status_listener(
self: Handle<CurvedAnimation>,
app: &mut App,
listener: &AnimationStatusListener,
)
fn remove_status_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: &AnimationStatusListener, )
Source§fn status(self: Handle<CurvedAnimation>, app: &App) -> AnimationStatus
fn status(self: Handle<CurvedAnimation>, app: &App) -> AnimationStatus
Source§fn value(self: Handle<CurvedAnimation>, app: &App) -> f64
fn value(self: Handle<CurvedAnimation>, 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 more