actor: Add "effects" to the animatable metas

Since ClutterEffect is an ActorMeta it should be possible to animate the
properties of named effects using the @effects syntax, just like it
happens for actions and constraints.
This commit is contained in:
Emmanuele Bassi 2010-06-01 14:45:55 +01:00
parent 0e9a1dee6d
commit 8ef4d9fe21
2 changed files with 13 additions and 6 deletions

View File

@ -172,7 +172,7 @@
* </informalexample>
* <para>The initial <emphasis>@</emphasis> is mandatory.</para>
* <para>The <emphasis>section</emphasis> fragment can be one between
* "actions" or "constraints".</para>
* "actions", "constraints" and "effects".</para>
* <para>The <emphasis>meta-name</emphasis> fragment is the name of the
* action or constraint, as specified by the #ClutterActorMeta:name
* property.</para>
@ -8401,6 +8401,7 @@ get_meta_from_animation_property (ClutterActor *actor,
*
* - actions
* - constraints
* - effects
*
* and <meta-name> is the name set on a specific ActorMeta
*/
@ -8420,6 +8421,9 @@ get_meta_from_animation_property (ClutterActor *actor,
if (strcmp (tokens[0], "constraints") == 0)
meta = _clutter_meta_group_get_meta (priv->constraints, tokens[1]);
if (strcmp (tokens[0], "effects") == 0)
meta = _clutter_meta_group_get_meta (priv->effects, tokens[1]);
if (name_p != NULL)
*name_p = g_strdup (tokens[2]);

View File

@ -20,6 +20,10 @@ test_rotate_main (int argc, char *argv[])
clutter_init (&argc, &argv);
/* Make a timeline */
timeline = clutter_timeline_new (7692);
clutter_timeline_set_loop (timeline, TRUE);
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage),
@ -35,7 +39,10 @@ test_rotate_main (int argc, char *argv[])
clutter_actor_set_position (hand, 240, 140);
clutter_actor_show (hand);
clutter_actor_add_effect (hand, clutter_desaturate_effect_new (0.75));
clutter_actor_add_effect_with_name (hand, "desaturate", clutter_desaturate_effect_new (0.75));
clutter_actor_animate_with_timeline (hand, CLUTTER_LINEAR, timeline,
"@effects.desaturate.factor", 1.0,
NULL);
label = clutter_text_new_with_text ("Mono 16",
"The Wonder\n"
@ -47,10 +54,6 @@ test_rotate_main (int argc, char *argv[])
clutter_container_add (CLUTTER_CONTAINER (stage), hand, label, NULL);
/* Make a timeline */
timeline = clutter_timeline_new (7692); /* num frames, fps */
clutter_timeline_set_loop (timeline, TRUE);
/* Set an alpha func to power behaviour */
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);