[gnome-nibbles] Migrate more from old clutter animation Removed unused animations in bonus/warp and removed one use



commit 177f6d8db4bb2f74eedfed05a5adebef6a12cabd
Author: Bryan Quigley <bryanquigs src gnome org>
Date:   Thu Jul 25 00:25:30 2013 -0400

    Migrate more from old clutter animation
    Removed unused animations in bonus/warp and removed one use from worm.c

 src/bonus.c |   46 +++++++++-------------------------------------
 src/warp.c  |   41 ++++++++---------------------------------
 src/worm.c  |   17 ++++++++---------
 3 files changed, 25 insertions(+), 79 deletions(-)
---
diff --git a/src/bonus.c b/src/bonus.c
index 8c54425..4b98789 100644
--- a/src/bonus.c
+++ b/src/bonus.c
@@ -36,36 +36,6 @@ extern GnibblesProperties *properties;
 extern GnibblesBoard *board;
 extern ClutterActor *stage;
 
-static void animate_bonus1 (ClutterAnimation *animation, ClutterActor *actor);
-static void animate_bonus2 (ClutterAnimation *animation, ClutterActor *actor);
-
-static void
-animate_bonus1 (ClutterAnimation *animation, ClutterActor *actor)
-{
-  g_signal_connect_after (
-    clutter_actor_animate (actor, CLUTTER_LINEAR, 1100,
-                           "scale-x", 1.22, "scale-y", 1.22,
-                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                           "opacity", 0xDC,
-                           NULL),
-     "completed", G_CALLBACK (animate_bonus2), actor);
-
-}
-
-static void
-animate_bonus2 (ClutterAnimation *animation, ClutterActor *actor)
-{
-  g_signal_connect_after (
-    clutter_actor_animate (actor, CLUTTER_LINEAR, 1100,
-                           "scale-x", 0.9, "scale-y", 0.9,
-                           "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                           "opacity", 0xFF,
-                           NULL),
-     "completed", G_CALLBACK (animate_bonus1), actor);
-
-}
-
-
 GnibblesBonus *
 gnibbles_bonus_new (gint t_x, gint t_y, gint t_type,
                     gint t_fake, gint t_countdown)
@@ -102,13 +72,15 @@ gnibbles_bonus_draw (GnibblesBonus *bonus)
 
   clutter_actor_set_opacity (bonus->actor, 0);
   clutter_actor_set_scale (bonus->actor, 3.0, 3.0);
-  //g_signal_connect_after (
-    clutter_actor_animate (bonus->actor, CLUTTER_EASE_OUT_BOUNCE, 800,
-                         "scale-x", 1.0, "scale-y", 1.0,
-                         "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                         "opacity", 0xff,
-                          NULL);
-  //"completed", G_CALLBACK (animate_bonus1), bonus->actor);
+
+  clutter_actor_save_easing_state(bonus->actor);
+  clutter_actor_set_easing_mode (bonus->actor, CLUTTER_EASE_OUT_BOUNCE);
+  clutter_actor_set_easing_duration (bonus->actor, 800);
+  clutter_actor_set_scale (bonus->actor, 1.0, 1.0);
+  clutter_actor_set_pivot_point (bonus->actor,.5,.5); 
+  clutter_actor_set_opacity (bonus->actor, 0xff);
+  clutter_actor_restore_easing_state(bonus->actor);
+
 }
 
 void
diff --git a/src/warp.c b/src/warp.c
index 1149a31..d39057b 100644
--- a/src/warp.c
+++ b/src/warp.c
@@ -34,32 +34,6 @@ extern GdkPixbuf *boni_pixmaps[];
 extern GnibblesBoard *board;
 extern ClutterActor *stage;
 
-static void animate_warp1 (ClutterAnimation *animation, ClutterActor *actor);
-static void animate_warp2 (ClutterAnimation *animation, ClutterActor *actor);
-
-static void
-animate_warp1 (ClutterAnimation *animation, ClutterActor *actor)
-{
-  g_signal_connect_after (
-    clutter_actor_animate (actor, CLUTTER_LINEAR, 1100,
-                           "opacity", 0x96,
-                           NULL),
-     "completed", G_CALLBACK (animate_warp2), actor);
-
-}
-
-static void
-animate_warp2 (ClutterAnimation *animation, ClutterActor *actor)
-{
-  g_signal_connect_after (
-    clutter_actor_animate (actor, CLUTTER_LINEAR, 1100,
-                           "opacity", 0xff,
-                           NULL),
-    "completed", G_CALLBACK (animate_warp1), actor);
-
-}
-
-
 GnibblesWarp *
 gnibbles_warp_new (gint t_x, gint t_y, gint t_wx, gint t_wy)
 {
@@ -93,11 +67,12 @@ gnibbles_warp_draw (GnibblesWarp *warp)
   clutter_actor_add_child (stage, warp->actor);
   clutter_actor_set_opacity (warp->actor, 0);
   clutter_actor_set_scale (warp->actor, 2.0, 2.0);
-  //g_signal_connect_after (
-    clutter_actor_animate (warp->actor, CLUTTER_EASE_OUT_CIRC, 410,
-                          "scale-x", 1.0, "scale-y", 1.0,
-                          "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
-                          "opacity", 0xff,
-                          NULL);
-   //"completed", G_CALLBACK (animate_warp1), warp->actor);
+
+  clutter_actor_save_easing_state(warp->actor);
+  clutter_actor_set_easing_mode (warp->actor, CLUTTER_EASE_OUT_CIRC);
+  clutter_actor_set_easing_duration (warp->actor, 410);
+  clutter_actor_set_scale (warp->actor, 1.0, 1.0);
+  clutter_actor_set_pivot_point (warp->actor,.5,.5); 
+  clutter_actor_set_opacity (warp->actor, 0xff);
+  clutter_actor_restore_easing_state(warp->actor);
 }
diff --git a/src/worm.c b/src/worm.c
index 21ad3ec..948626c 100644
--- a/src/worm.c
+++ b/src/worm.c
@@ -506,15 +506,14 @@ gnibbles_worm_animate_death (GnibblesWorm *worm)
 
   clutter_actor_add_child (stage, group);
 
-  clutter_actor_animate (group, CLUTTER_EASE_OUT_QUAD, 310,
-                         "opacity", 0,
-                         "scale-x", 2.0,
-                         "scale-y", 2.0,
-                         "fixed::scale-center-x",
-                         (gfloat) worm->xhead * properties->tilesize,
-                         "fixed::scale-center-y",
-                         (gfloat) worm->yhead * properties->tilesize,
-                         NULL);
+  clutter_actor_save_easing_state(group);
+  clutter_actor_set_easing_mode (group, CLUTTER_EASE_OUT_QUAD);
+  clutter_actor_set_easing_duration (group, 310);
+  clutter_actor_set_scale (group, 2.0, 2.0);
+  clutter_actor_set_pivot_point (group,.5,.5); 
+  clutter_actor_set_opacity (group, 0);
+  clutter_actor_restore_easing_state(group);
+
 }
 
 GnibblesWorm*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]