Last active
June 15, 2022 21:27
-
-
Save spydon/ef882b4f35cf772f12889e12d983731c to your computer and use it in GitHub Desktop.
Ball challenge
This file contains 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
import 'package:flame/components.dart'; | |
import 'package:flame/effects.dart'; | |
import 'package:flame/extensions.dart'; | |
import 'package:flame/game.dart'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
const radius = 30.0; | |
runApp( | |
GameWidget( | |
game: FlameGame( | |
children: [ | |
for (var i = 0; i < 10; i++) | |
CircleComponent( | |
radius: radius, | |
position: Vector2(80 + i * radius * 1.4, 150), | |
paint: Paint()..color = Colors.green.brighten(i / 20), | |
anchor: Anchor.center, | |
) | |
..add( | |
MoveByEffect( | |
Vector2(0, -60), | |
EffectController( | |
duration: 0.5, | |
curve: Curves.decelerate, | |
startDelay: i * 0.2, | |
alternate: true, | |
infinite: true, | |
), | |
), | |
) | |
..add( | |
ScaleEffect.to( | |
Vector2(1.2, 0.8), | |
EffectController( | |
duration: 0.5, | |
curve: Curves.easeInBack, | |
startDelay: i * 0.2, | |
alternate: true, | |
infinite: true, | |
), | |
), | |
), | |
], | |
), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment