Last active
May 27, 2022 15:39
-
-
Save SahanAmarsha/b618e61608e0433b1ffc2a8d938f6214 to your computer and use it in GitHub Desktop.
Defining a Pulse/Resize Animation in Flutter
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<Size> _myAnimation; | |
@override | |
void initState() { | |
// TODO: implement initState | |
super.initState(); | |
_controller = AnimationController( | |
vsync: this, | |
duration: Duration(milliseconds: 1000), | |
); | |
_myAnimation = Tween<Size>( | |
begin: Size(100, 100), | |
end: Size(120, 120) | |
).animate( | |
CurvedAnimation(parent: _controller, curve: Curves.bounceIn) | |
); | |
_controller.addStatusListener((AnimationStatus status) { | |
if (status == AnimationStatus.completed) { | |
_controller.repeat(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment