Skip to content

Instantly share code, notes, and snippets.

@ShaiqAhmedkhan
Last active January 29, 2020 12:33
Show Gist options
  • Save ShaiqAhmedkhan/0b6ea870192e8201bb147a8d843fa054 to your computer and use it in GitHub Desktop.
Save ShaiqAhmedkhan/0b6ea870192e8201bb147a8d843fa054 to your computer and use it in GitHub Desktop.
class _ExplicitState extends State<Explicit>
with TickerProviderStateMixin {
AnimationController _repeatingAnimationShort;
AnimationController _repeatingAnimationLong;
AnimationController _loopingAnimationShort;
AnimationController _loopingAnimationLong;
Animatable<double> _scaleCurve;
Animatable<Offset> _slideCurve;
Animatable<Offset> _reverseSlide;
Animatable<double> _scaleCurveSlow;
@override
void initState() {
super.initState();
_repeatingAnimationShort = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)..repeat();
_repeatingAnimationLong = AnimationController(
duration: const Duration(seconds: 15),
vsync: this,
)..repeat();
_loopingAnimationShort = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
_loopingAnimationShort.reverse();
} else if (status == AnimationStatus.dismissed) {
_loopingAnimationShort.forward();
}
})
..forward();
_loopingAnimationLong = AnimationController(
duration: const Duration(seconds: 30),
vsync: this,
)
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
_loopingAnimationLong.reverse();
} else if (status == AnimationStatus.dismissed) {
_loopingAnimationLong.forward();
}
})
..forward();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment