CurvedAnimation class Null safety

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
hashCode int
The hash code for this object.
read-onlyinherited
isCompleted bool
Whether this animation is stopped at the end.
read-onlyinherited
isDismissed bool
Whether this animation is stopped at the beginning.
read-onlyinherited
isDisposed bool
True if this CurvedAnimation has been disposed.
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
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
status AnimationStatus
The current status of this animation.
read-onlyinherited
value double
The current value of the animation.
read-onlyoverride

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.
optionalTypeArgs">@optionalTypeArgsinherited
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
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