[clutter] flow-layout: Implement layout animations



commit 320fb156b41fad5048b69acb7ca7a7e582b49182
Author: Bastian Winkler <buz netbuz org>
Date:   Thu May 24 16:06:31 2012 +0200

    flow-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-flow-layout.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-flow-layout.c b/clutter/clutter-flow-layout.c
index 97524b2..878feeb 100644
--- a/clutter/clutter-flow-layout.c
+++ b/clutter/clutter-flow-layout.c
@@ -568,6 +568,9 @@ clutter_flow_layout_allocate (ClutterLayoutManager   *manager,
   gint line_item_count;
   gint items_per_line;
   gint line_index;
+  gboolean use_animations;
+  ClutterAnimationMode easing_mode;
+  guint easing_duration, easing_delay;
 
   actor = CLUTTER_ACTOR (container);
   if (clutter_actor_get_n_children (actor) == 0)
@@ -600,6 +603,11 @@ clutter_flow_layout_allocate (ClutterLayoutManager   *manager,
   line_item_count = 0;
   line_index = 0;
 
+  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))
     {
@@ -701,8 +709,20 @@ clutter_flow_layout_allocate (ClutterLayoutManager   *manager,
       child_alloc.y1 = ceil (item_y);
       child_alloc.x2 = ceil (child_alloc.x1 + item_width);
       child_alloc.y2 = ceil (child_alloc.y1 + item_height);
+
+      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 (child, &child_alloc, flags);
 
+      if (use_animations)
+        clutter_actor_restore_easing_state (child);
+
       if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
         item_x = new_x;
       else



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