Created
June 10, 2020 17:26
-
-
Save SahanAmarsha/518cfd50bf31655011d5b3912ae654e1 to your computer and use it in GitHub Desktop.
Defining the Bounce Animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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