damn animations

This commit is contained in:
mem3Dealer
2021-01-08 22:09:37 +03:00
parent 8ef4390f93
commit 09df603a39

View File

@@ -23,7 +23,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
void initState() { void initState() {
super.initState(); super.initState();
_controller = AnimationController( _controller = AnimationController(
duration: Duration(seconds: 3), duration: Duration(seconds: 9),
vsync: this, vsync: this,
); );
} }
@@ -37,7 +37,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
Future _startAnim() async { Future _startAnim() async {
try { try {
await _controller.forward().orCancel; await _controller.forward().orCancel;
await _controller.reverse().orCancel; // await _controller.reverse().orCancel;
} on TickerCanceled { } on TickerCanceled {
print('welp we fucked'); print('welp we fucked');
} }
@@ -81,10 +81,43 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
class MovingHole extends StatelessWidget { class MovingHole extends StatelessWidget {
MovingHole({Key key, this.controller}) MovingHole({Key key, this.controller})
: width = Tween<double>(begin: 50.0, end: 150.0).animate(CurvedAnimation( : width = TweenSequence(
parent: controller, <TweenSequenceItem<double>>[
curve: Interval(0.0, 1, curve: Curves.fastOutSlowIn))), TweenSequenceItem<double>(
height = Tween<double>(begin: 50.0, end: 150.0).animate(CurvedAnimation( tween: Tween<double>(begin: 100, end: 150)
.chain(CurveTween(curve: Curves.ease)),
weight: 33.0,
),
TweenSequenceItem<double>(
tween: Tween<double>(begin: 150, end: 200),
weight: 33.0,
),
TweenSequenceItem<double>(
tween: Tween<double>(begin: 200, end: 300)
.chain(CurveTween(curve: Curves.ease)),
weight: 33.0,
),
],
).animate(CurvedAnimation(
parent: controller, curve: Interval(0.0, 1, curve: Curves.linear))),
height = TweenSequence(
<TweenSequenceItem<double>>[
TweenSequenceItem<double>(
tween: Tween<double>(begin: 100, end: 150)
.chain(CurveTween(curve: Curves.ease)),
weight: 40.0,
),
TweenSequenceItem<double>(
tween: Tween<double>(begin: 150, end: 200),
weight: 20.0,
),
TweenSequenceItem<double>(
tween: Tween<double>(begin: 200, end: 300)
.chain(CurveTween(curve: Curves.ease)),
weight: 40.0,
),
],
).animate(CurvedAnimation(
parent: controller, parent: controller,
curve: Interval(0.0, 1, curve: Curves.fastOutSlowIn))), curve: Interval(0.0, 1, curve: Curves.fastOutSlowIn))),
radius = BorderRadiusTween( radius = BorderRadiusTween(