mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
examples/box: Allow toggling animations
We need to set the easing duration to a positive value to let the BoxLayout animate the allocation.
This commit is contained in:
parent
d037890fc4
commit
c4a0f911b0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user