CurvedAnimation class

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.elasticIn will significantly overshoot or undershoot the default range of 0.0 to 1.0.

If you want to apply a Curve to a Tween, consider using CurveTween.

The following code snippet shows how you can apply a curve to a linear animation produced by an AnimationController controller.
link
final Animation<double> animation = CurvedAnimation(
  parent: controller,
  curve: Curves.ease,
);

This second code snippet shows how to apply a different curve in the forward direction than in the reverse direction. This can't be done using a CurveTween (since Tweens are not aware of the animation direction when they are applied).
link
final Animation<double> animation = CurvedAnimation(
  parent: controller,
  curve: Curves.easeIn,
  reverseCurve: Curves.easeOut,
);

By default, the reverseCurve matches the forward curve.

See also:

Inheritance
Mixed in types

Constructors

CurvedAnimation({required Animation<double> parent, required Curve curve, Curve? reverseCurve})
Creates a curved animation.

Properties

curve Curve
The curve to use in the forward direction.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isAnimating bool
Whether this animation is running in either direction.
no setterinherited
isCompleted bool
Whether this animation is stopped at the end.
no setterinherited
isDismissed bool
Whether this animation is stopped at the beginning.
no setterinherited
isDisposed bool
True if this CurvedAnimation has been disposed.
getter/setter pair
isForwardOrCompleted bool
Whether the current aim of the animation is toward completion.
no setterinherited
parent Animation<double>
The animation to which this animation applies a curve.
final
reverseCurve Curve?
The curve to use in the reverse direction.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status AnimationStatus
The current status of this animation.
no setterinherited
value double
The current value of the animation.
no setteroverride

Methods

addListener(VoidCallback listener) → void
Calls the listener every time the value of the animation changes.
inherited
addStatusListener(AnimationStatusListener listener) → void
Calls listener every time the status of the animation changes.
inherited
dispose() → void
Cleans up any listeners added by this CurvedAnimation.
drive<U>(Animatable<U> child) Animation<U>
Chains a Tween (or CurveTween) to this Animation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(VoidCallback listener) → void
Stop calling the listener every time the value of the animation changes.
inherited
removeStatusListener(AnimationStatusListener listener) → void
Stops calling the listener every time the status of the animation changes.
inherited
toString() String
A string representation of this object.
override
toStringDetails() String
Provides a string describing the status of this object, but not including information about the object itself.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited