Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Created June 10, 2020 17:26
Show Gist options
  • Save SahanAmarsha/518cfd50bf31655011d5b3912ae654e1 to your computer and use it in GitHub Desktop.
Save SahanAmarsha/518cfd50bf31655011d5b3912ae654e1 to your computer and use it in GitHub Desktop.
Defining the Bounce Animation
AnimationController _controller;
Animation<double> _slideAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 1000),
);
_slideAnimation = Tween(begin: 200.0, end: 120.0).animate(
CurvedAnimation(
parent: _controller,
curve: Interval(0.0, 1.0, curve: Curves.elasticIn),
),
)..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
_controller.repeat(reverse: true);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment