I want a certain actor to grow by 25% (around the click point) each time I
click on it.
clutter_actor_animate (...,
"scale-x", scale_x * 1.25,
"scale-y", scale_x * 1.25,
"fixed::scale-center-x", x,
"fixed::scale-center-y", y,
The first time I click this works fine. The second time, the actor jumps to a
different location. The reason for this is that the previous scale-center's
affect on the location of the actor on the screen is removed. I can think of a
complicated solution, but is there an easy way to do what I want to do?
Source attached:
Thanks,
rube
#include <clutter/clutter.h>
#include <stdlib.h>
static gboolean on_group_button_press (ClutterActor *group, ClutterEvent
*event, gpointer data)
{
gfloat x, y;
gdouble scale_x;
clutter_event_get_coords (event, &x, &y);
clutter_actor_transform_stage_point (group, x, y, &x, &y);
clutter_actor_get_scale (group, &scale_x, NULL);
clutter_actor_animate (
group,
CLUTTER_LINEAR,
1000,
"scale-x", scale_x * 1.25,
"scale-y", scale_x * 1.25,
"fixed::scale-center-x", x,
"fixed::scale-center-y", y,
NULL );
return TRUE;
}
int main(int argc, char *argv[])
{
clutter_init (&argc, &argv);
ClutterColor blue = { 0x00, 0x00, 0x80, 0xff };
ClutterActor *stage = clutter_stage_get_default ();
ClutterActor *group = clutter_group_new ();
ClutterActor *text = clutter_text_new_full ("Sans 50", "The Quick Brown Fox
Jumped Over The Lazy Dog", &blue);
clutter_text_set_line_wrap (CLUTTER_TEXT(text), TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (group), text);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
clutter_actor_set_size (text, 400, 400);
clutter_actor_set_size (stage, 500, 500);
clutter_actor_show (stage);
clutter_actor_set_reactive (group, TRUE);
g_signal_connect (group, "button-press-event", G_CALLBACK
(on_group_button_press), NULL);
clutter_main ();
return (0);
}