Cubic.straightLine constructor

Cubic.straightLine(
  1. double x0,
  2. double y0,
  3. double x1,
  4. double y1,
)

Generates a bezier curve that is a straight line between the given anchor points. The control points lie 1/3 of the distance from their respective anchor points.

Implementation

factory Cubic.straightLine(
  double x0,
  double y0,
  double x1,
  double y1,
) {
  return Cubic._raw([
    x0,
    y0,
    lerp(x0, x1, 1 / 3),
    lerp(y0, y1, 1 / 3),
    lerp(x0, x1, 2 / 3),
    lerp(y0, y1, 2 / 3),
    x1,
    y1,
  ]);
}