[clutter] examples/box: Allow toggling animations



commit c4a0f911b08ad5bce25433b1db8dd83bf6b25c28
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Aug 20 17:58:30 2012 +0100

    examples/box: Allow toggling animations
    
    We need to set the easing duration to a positive value to let the
    BoxLayout animate the allocation.

 examples/box-layout.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/examples/box-layout.c b/examples/box-layout.c
index 455dd95..867b9f6 100644
--- a/examples/box-layout.c
+++ b/examples/box-layout.c
@@ -21,10 +21,11 @@
 
 #define INSTRUCTIONS \
         "Press v\t\342\236\236\tSwitch horizontal/vertical\n"           \
-        "Press h\t\342\236\236\tSwitch homogeneous\n"			\
-        "Press p\t\342\236\236\tSwitch pack start/end\n"                \
+        "Press h\t\342\236\236\tToggle homogeneous\n"			\
+        "Press p\t\342\236\236\tToggle pack start/end\n"                \
         "Press s\t\342\236\236\tIncrement spacing (up to 12px)\n"       \
         "Press +\t\342\236\236\tAdd a new actor\n"                      \
+        "Press a\t\342\236\236\tToggle animations\n"                    \
         "Press q\t\342\236\236\tQuit"
 
 
@@ -189,6 +190,27 @@ key_release_cb (ClutterActor *stage,
 
   switch (clutter_event_get_key_symbol (event))
     {
+    case CLUTTER_KEY_a:
+      {
+        ClutterActorIter iter;
+        ClutterActor *child;
+
+        clutter_actor_iter_init (&iter, box);
+        while (clutter_actor_iter_next (&iter, &child))
+          {
+            guint duration;
+
+            duration = clutter_actor_get_easing_duration (child);
+            if (duration != 0)
+              duration = 0;
+            else
+              duration = 250;
+
+            clutter_actor_set_easing_duration (child, duration);
+          }
+      }
+      break;
+
     case CLUTTER_KEY_v:
       {
         ClutterOrientation orientation;



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