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:
Emmanuele Bassi 2008-11-20 10:52:09 +00:00
parent eeab42b765
commit 47150304cd
3 changed files with 43 additions and 18 deletions

View File

@ -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>
Fixed some trivial compiler warnings

View File

@ -1681,6 +1681,7 @@ clutter_actor_set_property (GObject *object,
ClutterVertex *center;
center = g_value_get_boxed (value);
if (center)
clutter_actor_set_rotation_internal (actor,
CLUTTER_X_AXIS,
priv->rxang,
@ -1694,6 +1695,7 @@ clutter_actor_set_property (GObject *object,
ClutterVertex *center;
center = g_value_get_boxed (value);
if (center)
clutter_actor_set_rotation_internal (actor,
CLUTTER_Y_AXIS,
priv->ryang,
@ -1707,6 +1709,7 @@ clutter_actor_set_property (GObject *object,
ClutterVertex *center;
center = g_value_get_boxed (value);
if (center)
clutter_actor_set_rotation_internal (actor,
CLUTTER_Z_AXIS,
priv->rzang,

View File

@ -24,11 +24,16 @@ on_button_press (ClutterActor *actor,
gint old_x, old_y, new_x, new_y;
guint old_width, old_height, new_width, new_height;
guint8 old_op, new_op;
gdouble new_angle;
ClutterVertex vertex = { 0, };
clutter_actor_get_position (actor, &old_x, &old_y);
clutter_actor_get_size (actor, &old_width, &old_height);
old_op = clutter_actor_get_opacity (actor);
/* determine the final state of the animation depending on
* the state of the actor
*/
if (!is_expanded)
{
new_x = old_x - 100;
@ -36,6 +41,7 @@ on_button_press (ClutterActor *actor,
new_width = old_width + 200;
new_height = old_height + 200;
new_op = 255;
new_angle = 360.0;
}
else
{
@ -44,8 +50,12 @@ on_button_press (ClutterActor *actor,
new_width = old_width - 200;
new_height = old_height - 200;
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 =
clutter_actor_animate (actor, CLUTTER_EASE_IN, 2000,
"x", new_x,
@ -53,6 +63,8 @@ on_button_press (ClutterActor *actor,
"width", new_width,
"height", new_height,
"opacity", new_op,
"rotation-angle-z", new_angle,
"fixed::rotation-center-z", &vertex,
"fixed::reactive", FALSE,
NULL);
g_signal_connect (animation,