CatmullRomCurve class

An animation easing curve that passes smoothly through the given control points using a centripetal Catmull-Rom spline.

When this curve is evaluated with transform, the values will interpolate smoothly from one control point to the next, passing through (0.0, 0.0), the given points, and then (1.0, 1.0).

Unlike most cubic splines, Catmull-Rom splines have the advantage that their curves pass through the control points given to them. They are cubic polynomial representations, and, in fact, Catmull-Rom splines can be converted mathematically into cubic splines. This class implements a "centripetal" Catmull-Rom spline. The term centripetal implies that it won't form loops or self-intersections within a single segment.

This class uses a centripetal Catmull-Rom curve (a CatmullRomSpline) as its internal representation. The term centripetal implies that it won't form loops or self-intersections within a single segment, and corresponds to a Catmull-Rom α (alpha) value of 0.5.

See also:

Inheritance

Constructors

CatmullRomCurve(List<Offset> controlPoints, {double tension = 0.0})
Constructs a centripetal CatmullRomCurve.
CatmullRomCurve.precompute(List<Offset> controlPoints, {double tension = 0.0})
Constructs a centripetal CatmullRomCurve.

Properties

controlPoints List<Offset>
The control points used to create this curve.
final
flipped Curve
Returns a new curve that is the reversed inversion of this one.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tension double
The "tension" of the curve.
final

Methods

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) double
Returns the value of the curve at point t.
inherited
transformInternal(double t) double
Returns the value of the curve at point t.
override

Operators

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

Static Methods

validateControlPoints(List<Offset>? controlPoints, {double tension = 0.0, List<String>? reasons}) bool
Validates that a given set of control points for a CatmullRomCurve is well-formed and will not produce a spline that self-intersects.