From 52acc71161532126d6c67923befadb18c1836932 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 19 May 2010 15:09:47 +0100 Subject: [PATCH] docs: Document animating action and constraint properties Add a refsect for the syntax to be used when animating action and constraint properties with ClutterAnimation. --- clutter/clutter-actor.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index f8227fe..a1dcde5 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -155,6 +155,65 @@ * should read the documentation for the #ClutterUnits parser format for * the valid units and syntax. * + * + * + * Custom animatable properties + * #ClutterActor allows accessing properties of #ClutterAction + * and #ClutterConstraint instances associated to an actor instance + * for animation purposes. + * In order to access a specific #ClutterAction or a #ClutterConstraint + * property it is necessary to set the #ClutterActorMeta:name property on the + * given action or constraint. + * The property can be accessed using the the following syntax: + * + * + * @<section>.<meta-name>.<property-name> + * + * + * The initial @ is mandatory. + * The section fragment can be one between + * "actions" or "constraints". + * The meta-name fragment is the name of the + * action or constraint, as specified by the #ClutterActorMeta:name + * property. + * The property-name fragment is the name of the + * action or constraint property to be animated. + * + * Animating a constraint property + * The example below animates a #ClutterBindConstraint applied to an + * actor using clutter_actor_animate(). The rect has + * a binding constraint for the origin actor, and in + * its initial state is fully transparent and overlapping the actor to + * which is bound to. + * + * constraint = clutter_bind_constraint_new (origin, CLUTTER_BIND_X, 0.0); + * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), "bind-x"); + * clutter_actor_add_constraint (rect, constraint); + * + * constraint = clutter_bind_constraint_new (origin, CLUTTER_BIND_Y, 0.0); + * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), "bind-y"); + * clutter_actor_add_constraint (rect, constraint); + * + * clutter_actor_set_reactive (rect, TRUE); + * clutter_actor_set_opacity (rect, 0); + * + * g_signal_connect (rect, "button-press-event", + * G_CALLBACK (on_button_press), + * NULL); + * + * On button press, the rectangle "slides" from behind the actor to + * which is bound to, using the #ClutterBindConstraint:offset property and + * the #ClutterActor:opacity property. + * + * float new_offset = clutter_actor_get_width (origin) + h_padding; + * + * clutter_actor_animate (rect, CLUTTER_EASE_OUT_CUBIC, 500, + * "opacity", 255, + * "@constraints.bind-x.offset", new_offset, + * NULL); + * + * + * */ /** -- 2.7.4