AnimationControllerLoopExtensions extension
Adds a loop extension on AnimationController identical to repeat but
adding a count
parameter specifying how many times to repeat before stopping:
count = null
: the animation loops infinitelycount = 0
: the animation won't playcount > 0
: the animation will playcount
times
The total time will always be count * duration
(or count * period
if specified).
Therefore, if reverse
is true, one "count" is still considered animating in a single direction.
For example, the following would play forward (fade in) and back (fade out) once, then stop:
Text('Hello World').animate(
onPlay: (controller) => controller.loop(
reverse: true,
count: 2,
),
).fadeIn();