[clutter] bin-layout: Implement layout animations



commit 03ec016faa146410c12b88851f0428d035933dd4
Author: Bastian Winkler <buz netbuz org>
Date:   Thu May 24 16:05:06 2012 +0200

    bin-layout: Implement layout animations
    
    Allow to animate the child allocation using the ClutterLayoutManager
    animation API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676827

 clutter/clutter-bin-layout.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-bin-layout.c b/clutter/clutter-bin-layout.c
index 8ba2157..bf4ad3e 100644
--- a/clutter/clutter-bin-layout.c
+++ b/clutter/clutter-bin-layout.c
@@ -428,12 +428,19 @@ clutter_bin_layout_allocate (ClutterLayoutManager   *manager,
   gfloat available_w, available_h;
   ClutterActor *actor, *child;
   ClutterActorIter iter;
+  gboolean use_animations;
+  ClutterAnimationMode easing_mode;
+  guint easing_duration, easing_delay;
 
   clutter_actor_box_get_origin (allocation, &allocation_x, &allocation_y);
   clutter_actor_box_get_size (allocation, &available_w, &available_h);
 
   actor = CLUTTER_ACTOR (container);
 
+  use_animations = clutter_layout_manager_get_easing_state (manager,
+                                                            &easing_mode,
+                                                            &easing_duration,
+                                                            &easing_delay);
   clutter_actor_iter_init (&iter, actor);
   while (clutter_actor_iter_next (&iter, &child))
     {
@@ -489,10 +496,21 @@ clutter_bin_layout_allocate (ClutterLayoutManager   *manager,
           y_align = get_bin_alignment_factor (layer->y_align);
         }
 
+      if (use_animations)
+        {
+          clutter_actor_save_easing_state (child);
+          clutter_actor_set_easing_mode (child, easing_mode);
+          clutter_actor_set_easing_duration (child, easing_duration);
+          clutter_actor_set_easing_delay (child, easing_delay);
+        }
+
       clutter_actor_allocate_align_fill (child, &child_alloc,
                                          x_align, y_align,
                                          x_fill, y_fill,
                                          flags);
+
+      if (use_animations)
+        clutter_actor_restore_easing_state (child);
     }
 }
 



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