build
clutter
doc
common
cookbook
examples
Makefile.am
actors-composite-main.c
animations-complex-overlapping.json
animations-complex.c
animations-complex.json
animations-looping-animator.c
animations-looping-implicit.c
animations-looping-state.c
animations-moving-animator.c
animations-moving-implicit.c
animations-moving-state.c
animations-path-circle.c
animations-path-easing.c
animations-path.c
animations-reuse-animation.json
animations-reuse-ui.json
animations-reuse.c
animations-rotating.c
animations-scaling-zoom.c
animations-scaling.c
cb-background-effect.c
cb-background-effect.h
cb-border-effect.c
cb-border-effect.h
cb-button.c
cb-button.h
cb-page-fold-effect.c
cb-page-fold-effect.h
effects-basic.c
effects-built-in.c
effects-custom-deform.c
events-buttons-click.c
events-buttons-lasso.c
events-buttons.c
events-mouse-scroll.c
events-pointer-motion-crossing.c
events-pointer-motion-scribbler.c
events-pointer-motion-stacked.c
events-pointer-motion.c
layouts-bind-constraint-allocation.c
layouts-bind-constraint-overlay.c
layouts-bind-constraint-stage.c
layouts-box-menu.c
layouts-box-property-effects.c
layouts-box.c
layouts-stacking-diff-sized-actors.c
layouts-stacking.c
script-signals.c
script-signals.json
script-states.c
script-states.json
script-ui.c
script-ui.json
smiley.png
text-shadow.c
textures-crossfade-cogl.c
textures-crossfade-slideshow.c
textures-crossfade.c
textures-reflection.c
textures-split-go.c
textures-sub-texture.c
images
videos
Makefile.am
actors.xml
animations.xml
clutter-cookbook.xml.in
effects.xml
events.xml
introduction.xml
layouts.xml
recipe-template.xml
script.xml
text.xml
textures.xml
version.xml.in
reference
AUTHORS.old
CODING_STYLE
HACKING
HACKING.backends
Makefile.am
RELEASING
actor-invariants.txt
size-negotiation.txt
po
tests
.gitignore
COPYING
ChangeLog.pre-git-import
Makefile.am
NEWS
README.in
README.md
autogen.sh
clutter.doap
config.h.win32.in
configure.ac
63 lines
1.9 KiB
C
63 lines
1.9 KiB
C
#include <stdlib.h>
|
|
#include <clutter/clutter.h>
|
|
|
|
int
|
|
main (int argc,
|
|
char *argv[])
|
|
{
|
|
ClutterActor *stage;
|
|
ClutterPath *path;
|
|
ClutterConstraint *constraint;
|
|
ClutterActor *rectangle;
|
|
ClutterTimeline *timeline;
|
|
|
|
const ClutterColor *stage_color = clutter_color_new (51, 51, 85, 255);
|
|
const ClutterColor *red_color = clutter_color_new (255, 0, 0, 255);
|
|
|
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
|
return 1;
|
|
|
|
stage = clutter_stage_new ();
|
|
clutter_actor_set_size (stage, 360, 300);
|
|
clutter_stage_set_color (CLUTTER_STAGE (stage), stage_color);
|
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
|
|
|
/* create the path */
|
|
path = clutter_path_new ();
|
|
clutter_path_add_move_to (path, 30, 60);
|
|
|
|
/* add a curve round to the top-right of the stage */
|
|
clutter_path_add_rel_curve_to (path,
|
|
120, 180,
|
|
180, 120,
|
|
240, 0);
|
|
|
|
/* create a constraint based on the path */
|
|
constraint = clutter_path_constraint_new (path, 0.0);
|
|
|
|
/* put a rectangle at the start of the path */
|
|
rectangle = clutter_rectangle_new_with_color (red_color);
|
|
clutter_actor_set_size (rectangle, 60, 60);
|
|
|
|
/* add the constraint to the rectangle */
|
|
clutter_actor_add_constraint_with_name (rectangle, "path", constraint);
|
|
|
|
/* add the rectangle to the stage */
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle);
|
|
|
|
/* set up the timeline */
|
|
timeline = clutter_timeline_new (1000);
|
|
clutter_timeline_set_repeat_count (timeline, -1);
|
|
clutter_timeline_set_auto_reverse (timeline, TRUE);
|
|
|
|
clutter_actor_animate_with_timeline (rectangle, CLUTTER_LINEAR, timeline,
|
|
"@constraints.path.offset", 1.0,
|
|
NULL);
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
clutter_main ();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|