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

Unified Diff: sky/sdk/example/game/lib/sprite_box.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/sprite_box.dart
diff --git a/sky/sdk/example/game/lib/sprite_box.dart b/sky/sdk/example/game/lib/sprite_box.dart
index 25598c381ef3b8542730b6992b996bfc660f93cb..aa5d064e2ac05f2274e9d90c3ec8f91df36c9742 100644
--- a/sky/sdk/example/game/lib/sprite_box.dart
+++ b/sky/sdk/example/game/lib/sprite_box.dart
@@ -287,10 +287,21 @@ class SpriteBox extends RenderBox {
// Print frame rate
if (_numFrames % 60 == 0) print("delta: $delta fps: $_frameRate");
+ _runActions(_rootNode, delta);
_callUpdate(_rootNode, delta);
_scheduleTick();
}
+ void _runActions(Node node, double dt) {
+ if (node._actions != null) {
+ node._actions.step(dt);
+ }
+ for (int i = node.children.length - 1; i >= 0; i--) {
kulakowski 2015/07/01 22:18:43 FYI List has a |reversed| property: for (final No
+ Node child = node.children[i];
+ _runActions(child, dt);
+ }
+ }
+
void _callUpdate(Node node, double dt) {
node.update(dt);
for (int i = node.children.length - 1; i >= 0; i--) {

Powered by Google App Engine
This is Rietveld 408576698