createAnimatedPath method

Path createAnimatedPath(
  1. Path originalPath,
  2. double animationPercent
)

Implementation

Path createAnimatedPath(Path originalPath, double animationPercent) {
  final totalLength = originalPath
      .computeMetrics()
      .fold(0.0, (double prev, PathMetric metric) => prev + metric.length);

  final currentLength = totalLength * animationPercent;

  return extractPathUntilLength(originalPath, currentLength);
}