2007-08-04 08:59:18 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
|
|
|
static gboolean zoom_in = TRUE;
|
|
|
|
static ClutterBehaviour *d_behave = NULL;
|
|
|
|
|
|
|
|
static void
|
|
|
|
timeline_completed (ClutterTimeline *timeline,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-11-13 13:21:56 +00:00
|
|
|
gint depth_start, depth_end;
|
2007-08-04 08:59:18 +00:00
|
|
|
|
|
|
|
if (zoom_in)
|
|
|
|
{
|
2007-11-21 11:55:26 +00:00
|
|
|
depth_start = 0;
|
|
|
|
depth_end = -500;
|
2007-08-04 08:59:18 +00:00
|
|
|
zoom_in = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-11-21 11:55:26 +00:00
|
|
|
depth_start = -500;
|
|
|
|
depth_end = 0;
|
2007-08-04 08:59:18 +00:00
|
|
|
zoom_in = TRUE;
|
|
|
|
}
|
|
|
|
|
2008-01-21 16:07:28 +00:00
|
|
|
clutter_behaviour_depth_set_bounds (CLUTTER_BEHAVIOUR_DEPTH (d_behave),
|
|
|
|
depth_start, depth_end);
|
2007-08-04 08:59:18 +00:00
|
|
|
|
|
|
|
clutter_timeline_rewind (timeline);
|
|
|
|
clutter_timeline_start (timeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
ClutterTimeline *timeline;
|
|
|
|
ClutterActor *stage;
|
2007-11-21 11:55:26 +00:00
|
|
|
ClutterActor *hand, *label, *rect;
|
2007-08-04 08:59:18 +00:00
|
|
|
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
2007-11-21 11:55:26 +00:00
|
|
|
ClutterColor rect_color = { 0, 0, 0, 0x88 };
|
2007-08-04 08:59:18 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", &error);
|
|
|
|
if (error)
|
|
|
|
g_error ("Unable to load redhand.png: %s", error->message);
|
|
|
|
|
|
|
|
stage = clutter_stage_get_default ();
|
|
|
|
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
2007-11-21 11:55:26 +00:00
|
|
|
clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE);
|
|
|
|
|
2007-08-04 08:59:18 +00:00
|
|
|
g_signal_connect (stage,
|
|
|
|
"button-press-event", G_CALLBACK (clutter_main_quit),
|
|
|
|
NULL);
|
|
|
|
|
2007-11-21 11:55:26 +00:00
|
|
|
label = clutter_label_new_with_text ("Mono 26", "Clutter");
|
|
|
|
clutter_actor_set_position (label, 40, 140);
|
|
|
|
clutter_actor_show (label);
|
|
|
|
|
2007-08-04 08:59:18 +00:00
|
|
|
hand = clutter_texture_new_from_pixbuf (pixbuf);
|
|
|
|
clutter_actor_set_position (hand, 240, 140);
|
|
|
|
clutter_actor_show (hand);
|
|
|
|
|
2007-11-21 11:55:26 +00:00
|
|
|
rect = clutter_rectangle_new_with_color (&rect_color);
|
|
|
|
clutter_actor_set_position (rect, 440, 140);
|
|
|
|
clutter_actor_set_size (rect, 200, 200);
|
|
|
|
clutter_actor_show (rect);
|
2007-08-04 08:59:18 +00:00
|
|
|
|
2007-11-21 11:55:26 +00:00
|
|
|
clutter_container_add (CLUTTER_CONTAINER (stage), hand, label, rect, NULL);
|
2007-08-04 08:59:18 +00:00
|
|
|
|
2007-11-21 11:55:26 +00:00
|
|
|
/* 3 seconds, at 60 fps */
|
|
|
|
timeline = clutter_timeline_new (180, 60);
|
2007-08-04 08:59:18 +00:00
|
|
|
g_signal_connect (timeline,
|
|
|
|
"completed", G_CALLBACK (timeline_completed),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
d_behave = clutter_behaviour_depth_new (clutter_alpha_new_full (timeline,
|
2007-08-05 23:13:27 +00:00
|
|
|
CLUTTER_ALPHA_RAMP_INC,
|
2007-08-04 08:59:18 +00:00
|
|
|
NULL, NULL),
|
2007-11-21 11:55:26 +00:00
|
|
|
-500, 0);
|
2007-08-04 08:59:18 +00:00
|
|
|
clutter_behaviour_apply (d_behave, hand);
|
|
|
|
clutter_behaviour_apply (d_behave, label);
|
2007-11-21 11:55:26 +00:00
|
|
|
clutter_behaviour_apply (d_behave, rect);
|
2007-08-04 08:59:18 +00:00
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
|
|
|
|
clutter_timeline_start (timeline);
|
|
|
|
|
|
|
|
clutter_main ();
|
|
|
|
|
|
|
|
g_object_unref (d_behave);
|
|
|
|
g_object_unref (timeline);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|