interactive/bin-layout: Use implicit animations

This commit is contained in:
Emmanuele Bassi 2012-03-15 11:25:52 +00:00
parent 389ee45747
commit 303ebaea88

View File

@ -74,11 +74,9 @@ on_box_enter (ClutterActor *box,
ClutterEvent *event, ClutterEvent *event,
ClutterActor *emblem) ClutterActor *emblem)
{ {
clutter_actor_animate (emblem, CLUTTER_LINEAR, 150, clutter_actor_set_opacity (emblem, 255);
"opacity", 255,
NULL);
return TRUE; return CLUTTER_EVENT_STOP;
} }
static gboolean static gboolean
@ -86,11 +84,9 @@ on_box_leave (ClutterActor *box,
ClutterEvent *event, ClutterEvent *event,
ClutterActor *emblem) ClutterActor *emblem)
{ {
clutter_actor_animate (emblem, CLUTTER_LINEAR, 150, clutter_actor_set_opacity (emblem, 0);
"opacity", 0,
NULL);
return TRUE; return CLUTTER_EVENT_STOP;
} }
static void static void
@ -99,15 +95,9 @@ on_rect_clicked (ClutterClickAction *action,
ClutterActor *box) ClutterActor *box)
{ {
if (!is_expanded) if (!is_expanded)
clutter_actor_animate (box, CLUTTER_EASE_OUT_BOUNCE, 250, clutter_actor_set_size (box, 400, 400);
"width", 400.0,
"height", 400.0,
NULL);
else else
clutter_actor_animate (box, CLUTTER_EASE_OUT_BOUNCE, 250, clutter_actor_set_size (box, 200, 200);
"width", 200.0,
"height", 200.0,
NULL);
is_expanded = !is_expanded; is_expanded = !is_expanded;
} }
@ -177,6 +167,8 @@ test_bin_layout_main (int argc, char *argv[])
clutter_actor_set_anchor_point_from_gravity (box, CLUTTER_GRAVITY_CENTER); clutter_actor_set_anchor_point_from_gravity (box, CLUTTER_GRAVITY_CENTER);
clutter_actor_set_position (box, 320, 240); clutter_actor_set_position (box, 320, 240);
clutter_actor_set_reactive (box, TRUE); clutter_actor_set_reactive (box, TRUE);
clutter_actor_set_easing_mode (box, CLUTTER_EASE_OUT_BOUNCE);
clutter_actor_set_easing_duration (box, 500);
clutter_actor_set_name (box, "box"); clutter_actor_set_name (box, "box");
/* the contents of the texture are created every time the allocation /* the contents of the texture are created every time the allocation
@ -241,6 +233,8 @@ test_bin_layout_main (int argc, char *argv[])
clutter_actor_set_reactive (rect, TRUE); clutter_actor_set_reactive (rect, TRUE);
clutter_actor_raise_top (rect); clutter_actor_raise_top (rect);
clutter_actor_set_name (rect, "emblem"); clutter_actor_set_name (rect, "emblem");
clutter_actor_set_easing_duration (rect, 150);
clutter_actor_set_easing_mode (rect, CLUTTER_LINEAR);
action = clutter_click_action_new (); action = clutter_click_action_new ();
clutter_actor_add_action (rect, action); clutter_actor_add_action (rect, action);