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.
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).
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.
read / write
parent Animation<double>
The animation to which this animation applies a curve.
final
reverseCurve Curve
The curve to use in the reverse direction. [...]
read / write
value double
The current value of the animation.
read-only, override
hashCode int
The hash code for this object. [...]
read-only, inherited
isCompleted bool
Whether this animation is stopped at the end.
read-only, inherited
isDismissed bool
Whether this animation is stopped at the beginning.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
status AnimationStatus
The current status of this animation.
read-only, inherited

Methods

toString() String
Returns a string representation of this object.
override
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
drive<U>(Animatable<U> child) Animation<U>
Chains a Tween (or CurveTween) to this Animation. [...]
@optionalTypeArgs, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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
toStringDetails() String
Provides a string describing the status of this object, but not including information about the object itself. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited