Clutter 0.8.2 Reference Manual |
---|
Clutter effects API provide a simplified abstraction for firing simple transitions from code. Clutter effects are created from a #ClutterEffectTemplate which is an abstraction of a timeline and an alpha function. An effect template can be created with:
ClutterEffectTemplate *etemplate = clutter_effect_template_new_for_duration (2000, CLUTTER_ALPHA_RAMP_INC);
This will create an effect template lasting 2000 milliseconds (2 seconds) and use an alpha function of %CLUTTER_ALPHA_RAMP_INC, there are other more advanced forms for creating effect templates from existing timelines, as well as attaching a callback to be called with user_data when the effect template is destroyed.
When we have an effect template we can create a temporary behaviour animating an actor simply by issuing:
clutter_effect_move (etemplate, actor, 23, 42, NULL, NULL);
and the actor will move from its current position to the coordinates (23, 42) in 2 seconds. Effects can also be stacked, so calling:
clutter_effect_move (etemplate, actor, 23, 42, NULL, NULL); clutter_effect_fade (etemplate, actor, 0, NULL, NULL);
The actor will move and fade out at the same time.
Since effects return a #ClutterTimeline, you can stop an effect from immediatly happening by calling clutter_timeline_stop () on the returned timeline.
The timeline and all the effect infrastructure is unreferenced as soon as the timeline emits the ClutterTimeline::completed signal.