ExpressiveShapeCubic.straightLine constructor

ExpressiveShapeCubic.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 ExpressiveShapeCubic.straightLine(
  double x0,
  double y0,
  double x1,
  double y1,
) {
  return ExpressiveShapeCubic._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,
  ]);
}