makeAnimation function

Animation<double> makeAnimation(
  1. AnimationController controller,
  2. double targetValue,
  3. Curve? curve, {
  4. double initialValue = 0,
})

Make Animation from controller to begin rotate effect. Rotate final position is targetValue.

Implementation

Animation<double> makeAnimation(
  AnimationController controller,
  double targetValue,
  Curve? curve, {
  double initialValue = 0,
}) {
  final begin = initialValue % (2 * pi);
  if (curve != null) {
    final curved = CurvedAnimation(parent: controller, curve: curve);
    return curved.drive(Tween(begin: begin, end: targetValue));
  } else {
    return controller.drive(Tween(begin: begin, end: targetValue));
  }
}