animateCSSSequence function
Future<void> ?
animateCSSSequence(
- Iterable<
CSSAnimationConfig> animationsConfig, { - Duration? initialDelay,
- int? repeat,
- bool? repeatInfinity,
Sames animateCSS
but runs animationsConfig
in sequence;
Implementation
Future<void>? animateCSSSequence(Iterable<CSSAnimationConfig> animationsConfig,
{Duration? initialDelay, int? repeat, bool? repeatInfinity}) {
var animationsList = animationsConfig.where((e) => e.isValid).toList();
if (animationsList.isEmpty) return null;
if (animationsList.length == 1) {
return animationsList[0].play(initialDelay: initialDelay);
}
repeat ??= 0;
repeatInfinity ??= false;
if (initialDelay != null && initialDelay.inMilliseconds > 0) {
return Future.delayed(initialDelay, () {
return _animateCSSSequenceRepeat(animationsList, repeat!, repeatInfinity);
});
} else {
return _animateCSSSequenceRepeat(animationsList, repeat, repeatInfinity);
}
}