Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: sky/sdk/example/game/lib/game_demo_world.dart

Issue 1215413002: First pass on action animations for sprites (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/example/game/lib/game_demo_world.dart
diff --git a/sky/sdk/example/game/lib/game_demo_world.dart b/sky/sdk/example/game/lib/game_demo_world.dart
index a65ed98d979f5d4efdaad38b2c4990ea61d9d99a..eff5fe2f90b337579ab1bf08be449bbaa5837dde 100644
--- a/sky/sdk/example/game/lib/game_demo_world.dart
+++ b/sky/sdk/example/game/lib/game_demo_world.dart
@@ -303,6 +303,12 @@ class Asteroid extends Sprite {
_rand.nextDouble() * _maxAsteroidSpeed * 2 - _maxAsteroidSpeed);
userInteractionEnabled = true;
+
+ // Rotate forever
+ double direction = (_rand.nextBool()) ? 360.0 : -360.0;
+ ActionTween rot = new ActionTween( (a) => rotation = a, 0.0, direction, 2.0 * _rand.nextDouble() + 2.0);
+ ActionRepeatForever repeat = new ActionRepeatForever(rot);
+ actions.run(repeat);
}
bool handleEvent(SpriteBoxEvent event) {

Powered by Google App Engine
This is Rietveld 408576698