Curve2D class abstract

Abstract class that defines an API for evaluating 2D parametric curves.

Curve2D differs from Curve in that the values interpolated are Offset values instead of double values, hence the "2D" in the name. They both take a single double t that has a range of 0.0 to 1.0, inclusive, as input to the transform function . Unlike Curve, Curve2D is not required to map t=0.0 and t=1.0 to specific output values.

The interpolated t value given to transform represents the progression along the curve, but it doesn't necessarily progress at a constant velocity, so incrementing t by, say, 0.1 might move along the curve by quite a lot at one part of the curve, or hardly at all in another part of the curve, depending on the definition of the curve.

This example shows how to use a Curve2D to modify the position of a widget so that it can follow an arbitrary path.

To create a local project with this code sample, run:
flutter create --sample=animation.Curve2D.1 mysample



Abstract const constructor to enable subclasses to provide const constructors so that they can be used in const expressions.


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
samplingSeed int
Returns a seed value used by generateSamples to seed a random number generator to avoid sample aliasing.
no setter


findInverse(double x) double
Returns the parameter t that corresponds to the given x value of the spline.
generateSamples({double start = 0.0, double end = 1.0, double tolerance = 1e-10}) Iterable<Curve2DSample>
Generates a list of samples with a recursive subdivision until a tolerance of tolerance is reached.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.
transform(double t) Offset
Returns the value of the curve at point t.
transformInternal(double t) Offset
Returns the value of the curve at point t.


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