Is it possible to create an animation in flutter that doesn't continously change its value, but only with a given time gaps?
I have the following code working right now, but i'm sure there is a better solution out there.
int aniValue = 0;
bool lock = false;
_asyncFunc() async {
if(lock) return;
else lock = true;
await new Future.delayed(const Duration(milliseconds: 50), () {
++aniValue;
if (aniValue == 41) {
aniValue = 0;
}
});
lock = false;
setState(() {});
_asyncFunc();
}
It is possible to define a Curve to animations; to have non-linear progression.
Flutter doesn't provides a "step" curves, but you can make one fairly easily:
You can then freely use it by associating it to a
CurveTween
:Another solution is using TweenSequence.