[clutter] examples: Update layout-manager example to use the animations API
- From: Bastian Winkler <bwinkler src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] examples: Update layout-manager example to use the animations API
- Date: Tue, 29 May 2012 12:12:49 +0000 (UTC)
commit 1339b391326ce30e88c4476cfd4bc288c74c304f
Author: Bastian Winkler <buz netbuz org>
Date: Thu May 24 20:25:22 2012 +0200
examples: Update layout-manager example to use the animations API
https://bugzilla.gnome.org/show_bug.cgi?id=676827
examples/layout-manager.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/examples/layout-manager.c b/examples/layout-manager.c
index 8e91022..d43cb9b 100644
--- a/examples/layout-manager.c
+++ b/examples/layout-manager.c
@@ -193,6 +193,9 @@ multi_layout_allocate (ClutterLayoutManager *manager,
int n_items, n_items_per_row, item_index;
ClutterPoint center;
double radius, theta;
+ gboolean use_animations;
+ ClutterAnimationMode easing_mode;
+ guint easing_duration, easing_delay;
n_items = get_visible_children (CLUTTER_ACTOR (container));
if (n_items == 0)
@@ -221,6 +224,11 @@ multi_layout_allocate (ClutterLayoutManager *manager,
(avail_height - self->cell_height) / 2.0);
}
+ use_animations = clutter_layout_manager_get_easing_state (manager,
+ &easing_mode,
+ &easing_duration,
+ &easing_delay);
+
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (container));
while (clutter_actor_iter_next (&iter, &child))
{
@@ -254,9 +262,18 @@ multi_layout_allocate (ClutterLayoutManager *manager,
child_allocation.y2 = child_allocation.y1 + self->cell_height;
}
- clutter_actor_save_easing_state (child);
+ 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_allocation, flags);
- clutter_actor_restore_easing_state (child);
+
+ if (use_animations)
+ clutter_actor_restore_easing_state (child);
item_index += 1;
}
@@ -365,6 +382,7 @@ main (int argc, char *argv[])
manager = multi_layout_new ();
multi_layout_set_spacing ((MultiLayout *) manager, PADDING);
+ clutter_layout_manager_set_use_animations (manager, TRUE);
margin.top = margin.bottom = margin.left = margin.right = PADDING;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]