mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
2008-11-20 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-actor.c: (clutter_actor_set_property): Add sanity checks for NULL boxed values when setting the rotation center. * tests/interactive/test-animation.c: (on_button_press): Add an example on how to use the rotation properties to animate an actor.
This commit is contained in:
parent
eeab42b765
commit
47150304cd
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2008-11-20 Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
|
|
||||||
|
* clutter/clutter-actor.c:
|
||||||
|
(clutter_actor_set_property): Add sanity checks for NULL
|
||||||
|
boxed values when setting the rotation center.
|
||||||
|
|
||||||
|
* tests/interactive/test-animation.c:
|
||||||
|
(on_button_press): Add an example on how to use the rotation
|
||||||
|
properties to animate an actor.
|
||||||
|
|
||||||
2008-11-18 Neil Roberts <neil@linux.intel.com>
|
2008-11-18 Neil Roberts <neil@linux.intel.com>
|
||||||
|
|
||||||
Fixed some trivial compiler warnings
|
Fixed some trivial compiler warnings
|
||||||
|
@ -1681,12 +1681,13 @@ clutter_actor_set_property (GObject *object,
|
|||||||
ClutterVertex *center;
|
ClutterVertex *center;
|
||||||
|
|
||||||
center = g_value_get_boxed (value);
|
center = g_value_get_boxed (value);
|
||||||
clutter_actor_set_rotation_internal (actor,
|
if (center)
|
||||||
CLUTTER_X_AXIS,
|
clutter_actor_set_rotation_internal (actor,
|
||||||
priv->rxang,
|
CLUTTER_X_AXIS,
|
||||||
0,
|
priv->rxang,
|
||||||
center->y,
|
0,
|
||||||
center->z);
|
center->y,
|
||||||
|
center->z);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_ROTATION_CENTER_Y:
|
case PROP_ROTATION_CENTER_Y:
|
||||||
@ -1694,12 +1695,13 @@ clutter_actor_set_property (GObject *object,
|
|||||||
ClutterVertex *center;
|
ClutterVertex *center;
|
||||||
|
|
||||||
center = g_value_get_boxed (value);
|
center = g_value_get_boxed (value);
|
||||||
clutter_actor_set_rotation_internal (actor,
|
if (center)
|
||||||
CLUTTER_Y_AXIS,
|
clutter_actor_set_rotation_internal (actor,
|
||||||
priv->ryang,
|
CLUTTER_Y_AXIS,
|
||||||
center->x,
|
priv->ryang,
|
||||||
0,
|
center->x,
|
||||||
center->z);
|
0,
|
||||||
|
center->z);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_ROTATION_CENTER_Z:
|
case PROP_ROTATION_CENTER_Z:
|
||||||
@ -1707,12 +1709,13 @@ clutter_actor_set_property (GObject *object,
|
|||||||
ClutterVertex *center;
|
ClutterVertex *center;
|
||||||
|
|
||||||
center = g_value_get_boxed (value);
|
center = g_value_get_boxed (value);
|
||||||
clutter_actor_set_rotation_internal (actor,
|
if (center)
|
||||||
CLUTTER_Z_AXIS,
|
clutter_actor_set_rotation_internal (actor,
|
||||||
priv->rzang,
|
CLUTTER_Z_AXIS,
|
||||||
center->x,
|
priv->rzang,
|
||||||
center->y,
|
center->x,
|
||||||
0);
|
center->y,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_ANCHOR_X:
|
case PROP_ANCHOR_X:
|
||||||
|
@ -24,11 +24,16 @@ on_button_press (ClutterActor *actor,
|
|||||||
gint old_x, old_y, new_x, new_y;
|
gint old_x, old_y, new_x, new_y;
|
||||||
guint old_width, old_height, new_width, new_height;
|
guint old_width, old_height, new_width, new_height;
|
||||||
guint8 old_op, new_op;
|
guint8 old_op, new_op;
|
||||||
|
gdouble new_angle;
|
||||||
|
ClutterVertex vertex = { 0, };
|
||||||
|
|
||||||
clutter_actor_get_position (actor, &old_x, &old_y);
|
clutter_actor_get_position (actor, &old_x, &old_y);
|
||||||
clutter_actor_get_size (actor, &old_width, &old_height);
|
clutter_actor_get_size (actor, &old_width, &old_height);
|
||||||
old_op = clutter_actor_get_opacity (actor);
|
old_op = clutter_actor_get_opacity (actor);
|
||||||
|
|
||||||
|
/* determine the final state of the animation depending on
|
||||||
|
* the state of the actor
|
||||||
|
*/
|
||||||
if (!is_expanded)
|
if (!is_expanded)
|
||||||
{
|
{
|
||||||
new_x = old_x - 100;
|
new_x = old_x - 100;
|
||||||
@ -36,6 +41,7 @@ on_button_press (ClutterActor *actor,
|
|||||||
new_width = old_width + 200;
|
new_width = old_width + 200;
|
||||||
new_height = old_height + 200;
|
new_height = old_height + 200;
|
||||||
new_op = 255;
|
new_op = 255;
|
||||||
|
new_angle = 360.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -44,8 +50,12 @@ on_button_press (ClutterActor *actor,
|
|||||||
new_width = old_width - 200;
|
new_width = old_width - 200;
|
||||||
new_height = old_height - 200;
|
new_height = old_height - 200;
|
||||||
new_op = 128;
|
new_op = 128;
|
||||||
|
new_angle = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vertex.x = CLUTTER_UNITS_FROM_FLOAT ((float) new_width / 2);
|
||||||
|
vertex.y = CLUTTER_UNITS_FROM_FLOAT ((float) new_height / 2);
|
||||||
|
|
||||||
animation =
|
animation =
|
||||||
clutter_actor_animate (actor, CLUTTER_EASE_IN, 2000,
|
clutter_actor_animate (actor, CLUTTER_EASE_IN, 2000,
|
||||||
"x", new_x,
|
"x", new_x,
|
||||||
@ -53,6 +63,8 @@ on_button_press (ClutterActor *actor,
|
|||||||
"width", new_width,
|
"width", new_width,
|
||||||
"height", new_height,
|
"height", new_height,
|
||||||
"opacity", new_op,
|
"opacity", new_op,
|
||||||
|
"rotation-angle-z", new_angle,
|
||||||
|
"fixed::rotation-center-z", &vertex,
|
||||||
"fixed::reactive", FALSE,
|
"fixed::reactive", FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
g_signal_connect (animation,
|
g_signal_connect (animation,
|
||||||
|
Loading…
Reference in New Issue
Block a user