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.
link

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

Inheritance
Implementers

Constructors

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

Properties

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

Methods

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.
inherited
toString() String
A string representation of this object.
inherited
transform(double t) Offset
Returns the value of the curve at point t.
inherited
transformInternal(double t) Offset
Returns the value of the curve at point t.
inherited

Operators

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