Skip to main content

CurvedAnimation

Struct CurvedAnimation 

Source
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: bool

True if this CurvedAnimation has been disposed.

Implementations§

Source§

impl CurvedAnimation

Source

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.

Source

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

Source§

fn add_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: Listener, )

Calls the listener every time the value of the animation changes. Read more
Source§

fn remove_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: &Listener, )

Stop calling the listener every time the value of the animation changes. Read more
Source§

fn add_status_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: AnimationStatusListener, )

Calls listener every time the status of the animation changes. Read more
Source§

fn remove_status_listener( self: Handle<CurvedAnimation>, app: &mut App, listener: &AnimationStatusListener, )

Stops calling the listener every time the status of the animation changes. Read more
Source§

fn status(self: Handle<CurvedAnimation>, app: &App) -> AnimationStatus

The current status of this animation.
Source§

fn value(self: Handle<CurvedAnimation>, app: &App) -> f64

The current value of the animation. Read more
Source§

fn is_dismissed(self: Handle<Self>, app: &App) -> bool

Whether this animation is stopped at the beginning.
Source§

fn is_completed(self: Handle<Self>, app: &App) -> bool

Whether this animation is stopped at the end.
Source§

fn is_animating(self: Handle<Self>, app: &App) -> bool

Whether this animation is running in either direction.
Source§

fn is_forward_or_completed(self: Handle<Self>, app: &App) -> bool

Whether the current aim of this animation is toward completion.
Source§

fn to_string_details(self: Handle<Self>, app: &App) -> String

Dart’s Animation.toStringDetails: the status as its arrow.
Source§

fn to_string(self: Handle<Self>, app: &App) -> String

Dart’s Animation.toString: the identity and toStringDetails.
Source§

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>. Read more
Source§

impl AnimationWithParent<f64> for CurvedAnimation

Source§

fn parent(self: Handle<CurvedAnimation>, app: &App) -> AnyAnimation<f64>

The animation whose value this animation will proxy. Read more
Source§

fn add_listener(self: Handle<Self>, app: &mut App, listener: Listener)

Calls the listener every time the value of the animation changes. Read more
Source§

fn remove_listener(self: Handle<Self>, app: &mut App, listener: &Listener)

Stop calling the listener every time the value of the animation changes. Read more
Source§

fn add_status_listener( self: Handle<Self>, app: &mut App, listener: AnimationStatusListener, )

Calls listener every time the status of the animation changes. Read more
Source§

fn remove_status_listener( self: Handle<Self>, app: &mut App, listener: &AnimationStatusListener, )

Stops calling the listener every time the status of the animation changes. Read more
Source§

fn status(self: Handle<Self>, app: &App) -> AnimationStatus

The current status of this animation.

Auto Trait Implementations§

§

impl !RefUnwindSafe for CurvedAnimation

§

impl !Send for CurvedAnimation

§

impl !Sync for CurvedAnimation

§

impl !UnwindSafe for CurvedAnimation

§

impl Forget for CurvedAnimation

§

impl Freeze for CurvedAnimation
where NonZero<u32>: Freeze, &'static AnimationVTable<f64>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn Curve> is !null: Freeze, PhantomData<RcInner<dyn Curve>>: Freeze,

§

impl Move for CurvedAnimation

§

impl Unpin for CurvedAnimation
where NonZero<u32>: Unpin, &'static AnimationVTable<f64>: Unpin, Rc<Keep>: Unpin, Rc<dyn Curve>: Unpin,

§

impl UnsafeUnpin for CurvedAnimation
where NonZeroU32Inner: UnsafeUnpin, &'static AnimationVTable<f64>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn Curve> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Curve>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>