animateLoopRotation method
void
animateLoopRotation({})
Implementation
void animateLoopRotation({
required List<double> angles,
required int repeatCount,
bool normalizeOnFinish = true,
List<Duration>? pauseDuration,
List<Duration>? rotationDuration,
List<Curve>? curves,
VoidCallback? onFinish,
}) async {
int currentRepetition = 0;
int currentRotation = 0;
while (currentRepetition < repeatCount) {
currentRotation = 0;
await Future.forEach<double>(angles, (rotateAngle) async {
animateSimpleRotation(
angle: rotateAngle,
duration: rotationDuration?[currentRotation],
curve: curves?[currentRotation] ?? Curves.decelerate,
);
await Future.delayed(
pauseDuration?[currentRotation] ?? const Duration(seconds: 1),
);
currentRotation++;
});
currentRepetition++;
}
if (normalizeOnFinish) gameRef.camera.animateSimpleRotation(angle: 0.0);
onFinish?.call();
}