toPath method
progress is the Morph's progress.
path is a Path to reset and set with the new path data.
startAngle is an angle (in degrees) to rotate the Path to start
drawing from. If startAngle is non zero, then caller has to use the
returned Path, as path transformation creates a new path.
repeatPath is whether or not to repeat the Path twice before closing
it. This flag 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 a motion as a Star circular
progress indicator advances).
closePath is whether or not to close the created Path.
rotationPivotX is the rotation pivot on the X axis. By default it's set
to 0, and that should align with Morph instances that were created for
RoundedPolygon with zero centerX. In case the RoundedPolygon were
normalized (i. e. moved to (0.5, 0.5)), or where created with a different
centerX coordinated, this pivot point may need to be aligned to support a
proper rotation.
rotationPivotY is the rotation pivot on the Y axis. By default it's set
to 0, and that should align with Morph instances that were created for
RoundedPolygon with zero centerY. In case the RoundedPolygon were
normalized (i. e. moves to (0.5, 0.5)), or where created with a different
centerY coordinated, this pivot point may need to be aligned to support a
proper rotation.
Implementation
Path toPath({
required double progress,
int startAngle = 0,
bool repeatPath = false,
bool closePath = true,
double rotationPivotX = 0,
double rotationPivotY = 0,
Path? path,
}) {
return pathFromCubics(
path: path ?? Path(),
startAngle: startAngle,
repeatPath: repeatPath,
closePath: closePath,
cubics: asCubics(progress),
rotationPivotX: rotationPivotX,
rotationPivotY: rotationPivotY,
);
}