makeInfiniteRollAnimation function
Animation<double>
makeInfiniteRollAnimation(
- AnimationController controller, {
- required bool clockwise,
- double initialValue = 0,
- Curve? curve,
Make Animation from controller to begin infinite roll effect.
Implementation
Animation<double> makeInfiniteRollAnimation(
AnimationController controller, {
required bool clockwise,
double initialValue = 0,
Curve? curve,
}) {
final begin = initialValue % (2 * pi);
final end = begin + 2 * pi * (clockwise ? 1 : -1);
final tween = Tween(begin: begin, end: end);
if (curve != null) {
final curved = CurvedAnimation(parent: controller, curve: curve);
return curved.drive(tween);
} else {
return controller.drive(tween);
}
}