controlPoints property

List<Offset> controlPoints
final

The control points used to create this curve.

The dx value of each Offset in controlPoints represents the animation value at which the curve should pass through the dy value of the same control point.

The controlPoints list must meet the following criteria:

  • The list must contain at least two points.
  • The X value of each point must be greater than 0.0 and less then 1.0.
  • The X values of each point must be greater than the previous point's X value (i.e. monotonically increasing). The Y values are not constrained.
  • The resulting spline must be single-valued in X. That is, for each X value, there must be exactly one Y value. This means that the control points must not generated a spline that loops or overlaps itself.

The static function validateControlPoints can be used to check that these conditions are met, and will return true if they are. In debug mode, it will also optionally return a list of reasons in text form. In debug mode, the constructor will assert that these conditions are met and print the reasons if the assert fires.

When the 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 control points, and (1.0, 1.0).

Implementation

final List<Offset> controlPoints;