Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Created June 10, 2020 13:04
Show Gist options
  • Save SahanAmarsha/e95a6d000a9e1866b4be7d3aaebf8891 to your computer and use it in GitHub Desktop.
Save SahanAmarsha/e95a6d000a9e1866b4be7d3aaebf8891 to your computer and use it in GitHub Desktop.
Defining a Hinge Animation
AnimationController _controller;
Animation _rotateAnimation;
Animation<double> _slideAnimation;
Animation<double> _opacityAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 3000),
);
_rotateAnimation = Tween(end: 0.15, begin: 0.0)
.animate(
CurvedAnimation(
parent: _controller,
curve: Interval(0.0, 0.5, curve: Curves.bounceInOut),
),
);
_slideAnimation = Tween(begin: 100.0, end: 600.0).animate(
CurvedAnimation(
parent: _controller,
curve: Interval(0.5, 1.0, curve: Curves.fastOutSlowIn),
),
);
_opacityAnimation = Tween(begin: 1.0, end: 0.0).animate(
CurvedAnimation(
parent: _controller,
curve: Interval(0.5, 1.0, curve: Curves.fastOutSlowIn),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment