toPath method

Path toPath(
  1. double progress, {
  2. double startAngle = 0.0,
  3. bool repeatPath = false,
  4. bool closePath = true,
  5. Offset rotationPivot = .zero,
  6. Path? path,
})

Returns a Path for this morph's shape at progress.

progress runs from 0 at start to 1 at end, and a value in between gives a linear interpolation of the two. See toCubics for what values outside that range do.

startAngle places the start point of the first curve at that angle, in radians, around rotationPivot, rotating the whole path to get it there. Zero is to the right of the pivot and pi / 2 below it, since y grows downwards. The default of zero is special: it skips the rotation entirely and leaves the curves as toCubics produced them.

If repeatPath is true, the curves are added twice before the Path is closed. This is useful when the caller would like to draw parts of the path while offsetting the start and stop positions, for example when phasing and rotating a path to simulate motion as a star-shaped circular progress indicator advances.

If closePath is false, the returned Path is left open.

rotationPivot is the point startAngle rotates the path around, and the point its angle is measured from. It defaults to the origin, which suits a Morph between polygons with a zero RoundedPolygon.center. A Morph between polygons centered elsewhere should pass their center, (0.5, 0.5) for normalized ones.

Implementation

Path toPath(
  double progress, {
  double startAngle = 0.0,
  bool repeatPath = false,
  bool closePath = true,
  Offset rotationPivot = .zero,
  Path? path,
}) => pathFromCubics(
  toCubics(progress),
  startAngle: startAngle,
  repeatPath: repeatPath,
  closePath: closePath,
  rotationPivot: rotationPivot,
  path: path,
);