Implicit Animations

Implicit Animations — Simple implicit animations

Synopsis

                    ClutterAnimation;
                    ClutterAnimationClass;
enum                ClutterAnimationMode;
ClutterAnimation *  clutter_animation_new               (void);
void                clutter_animation_set_object        (ClutterAnimation *animation,
                                                         GObject *object);
GObject *           clutter_animation_get_object        (ClutterAnimation *animation);
void                clutter_animation_set_mode          (ClutterAnimation *animation,
                                                         gulong mode);
gulong              clutter_animation_get_mode          (ClutterAnimation *animation);
void                clutter_animation_set_duration      (ClutterAnimation *animation,
                                                         gint msecs);
guint               clutter_animation_get_duration      (ClutterAnimation *animation);
void                clutter_animation_set_loop          (ClutterAnimation *animation,
                                                         gboolean loop);
gboolean            clutter_animation_get_loop          (ClutterAnimation *animation);
void                clutter_animation_set_timeline      (ClutterAnimation *animation,
                                                         ClutterTimeline *timeline);
ClutterTimeline *   clutter_animation_get_timeline      (ClutterAnimation *animation);
void                clutter_animation_set_alpha         (ClutterAnimation *animation,
                                                         ClutterAlpha *alpha);
ClutterAlpha *      clutter_animation_get_alpha         (ClutterAnimation *animation);
void                clutter_animation_completed         (ClutterAnimation *animation);

ClutterAnimation *  clutter_animation_bind              (ClutterAnimation *animation,
                                                         const gchar *property_name,
                                                         const GValue *final);
ClutterAnimation *  clutter_animation_bind_interval     (ClutterAnimation *animation,
                                                         const gchar *property_name,
                                                         ClutterInterval *interval);
void                clutter_animation_update_interval   (ClutterAnimation *animation,
                                                         const gchar *property_name,
                                                         ClutterInterval *interval);
gboolean            clutter_animation_has_property      (ClutterAnimation *animation,
                                                         const gchar *property_name);
void                clutter_animation_unbind_property   (ClutterAnimation *animation,
                                                         const gchar *property_name);
ClutterInterval *   clutter_animation_get_interval      (ClutterAnimation *animation,
                                                         const gchar *property_name);

ClutterAnimation *  clutter_actor_animate               (ClutterActor *actor,
                                                         gulong mode,
                                                         guint duration,
                                                         const gchar *first_property_name,
                                                         ...);
ClutterAnimation *  clutter_actor_animate_with_timeline (ClutterActor *actor,
                                                         gulong mode,
                                                         ClutterTimeline *timeline,
                                                         const gchar *first_property_name,
                                                         ...);
ClutterAnimation *  clutter_actor_animate_with_alpha    (ClutterActor *actor,
                                                         ClutterAlpha *alpha,
                                                         const gchar *first_property_name,
                                                         ...);
ClutterAnimation *  clutter_actor_animatev              (ClutterActor *actor,
                                                         gulong mode,
                                                         guint duration,
                                                         gint n_properties,
                                                         const gchar * const properties[],
                                                         const GValue *values);
ClutterAnimation *  clutter_actor_animate_with_timelinev
                                                        (ClutterActor *actor,
                                                         gulong mode,
                                                         ClutterTimeline *timeline,
                                                         gint n_properties,
                                                         const gchar * const properties[],
                                                         const GValue *values);
ClutterAnimation *  clutter_actor_animate_with_alphav   (ClutterActor *actor,
                                                         ClutterAlpha *alpha,
                                                         gint n_properties,
                                                         const gchar * const properties[],
                                                         const GValue *values);
ClutterAnimation *  clutter_actor_get_animation         (ClutterActor *actor);

Description

ClutterAnimation is an object providing simple, implicit animations for GObjects.

ClutterAnimation instances will bind a GObject property belonging to a GObject to a ClutterInterval, and will then use a ClutterTimeline to interpolate the property between the initial and final values of the interval.

For convenience, it is possible to use the clutter_actor_animate() function call which will take care of setting up and tearing down a ClutterAnimation instance and animate an actor between its current state and the specified final state.

ClutterAnimation is available since Clutter 1.0

Details

ClutterAnimation

typedef struct {
} ClutterAnimation;

The ClutterAnimation structure contains only private data and should be accessed using the provided functions.

Since 1.0


ClutterAnimationClass

typedef struct {
  void (* completed) (ClutterAnimation *animation);
} ClutterAnimationClass;

The ClutterAnimationClass structure contains only private data and should be accessed using the provided functions.

completed ()

class handler for the "completed" signal

Since 1.0


enum ClutterAnimationMode

typedef enum {
  CLUTTER_CUSTOM_MODE = 0,

  /* linear */
  CLUTTER_LINEAR,

  /* quadratic */
  CLUTTER_EASE_IN_QUAD,
  CLUTTER_EASE_OUT_QUAD,
  CLUTTER_EASE_IN_OUT_QUAD,

  /* cubic */
  CLUTTER_EASE_IN_CUBIC,
  CLUTTER_EASE_OUT_CUBIC,
  CLUTTER_EASE_IN_OUT_CUBIC,

  /* quartic */
  CLUTTER_EASE_IN_QUART,
  CLUTTER_EASE_OUT_QUART,
  CLUTTER_EASE_IN_OUT_QUART,

  /* quintic */
  CLUTTER_EASE_IN_QUINT,
  CLUTTER_EASE_OUT_QUINT,
  CLUTTER_EASE_IN_OUT_QUINT,

  /* sinusoidal */
  CLUTTER_EASE_IN_SINE,
  CLUTTER_EASE_OUT_SINE,
  CLUTTER_EASE_IN_OUT_SINE,

  /* exponential */
  CLUTTER_EASE_IN_EXPO,
  CLUTTER_EASE_OUT_EXPO,
  CLUTTER_EASE_IN_OUT_EXPO,

  /* circular */
  CLUTTER_EASE_IN_CIRC,
  CLUTTER_EASE_OUT_CIRC,
  CLUTTER_EASE_IN_OUT_CIRC,

  /* elastic */
  CLUTTER_EASE_IN_ELASTIC,
  CLUTTER_EASE_OUT_ELASTIC,
  CLUTTER_EASE_IN_OUT_ELASTIC,

  /* overshooting cubic */
  CLUTTER_EASE_IN_BACK,
  CLUTTER_EASE_OUT_BACK,
  CLUTTER_EASE_IN_OUT_BACK,

  /* exponentially decaying parabolic */
  CLUTTER_EASE_IN_BOUNCE,
  CLUTTER_EASE_OUT_BOUNCE,
  CLUTTER_EASE_IN_OUT_BOUNCE,

  /* guard, before registered alpha functions */
  CLUTTER_ANIMATION_LAST
} ClutterAnimationMode;

The animation modes used by ClutterAlpha and ClutterAnimation. This enumeration can be expanded in later versions of Clutter. See the ClutterAlpha documentation for a graph of all the animation modes.

Every global alpha function registered using clutter_alpha_register_func() or clutter_alpha_register_closure() will have a logical id greater than CLUTTER_ANIMATION_LAST.

CLUTTER_CUSTOM_MODE

custom progress function

CLUTTER_LINEAR

linear tweening

CLUTTER_EASE_IN_QUAD

quadratic tweening

CLUTTER_EASE_OUT_QUAD

quadratic tweening, inverse of CLUTTER_EASE_IN_QUAD

CLUTTER_EASE_IN_OUT_QUAD

quadratic tweening, combininig CLUTTER_EASE_IN_QUAD and CLUTTER_EASE_OUT_QUAD

CLUTTER_EASE_IN_CUBIC

cubic tweening

CLUTTER_EASE_OUT_CUBIC

cubic tweening, invers of CLUTTER_EASE_IN_CUBIC

CLUTTER_EASE_IN_OUT_CUBIC

cubic tweening, combining CLUTTER_EASE_IN_CUBIC and CLUTTER_EASE_OUT_CUBIC

CLUTTER_EASE_IN_QUART

quartic tweening

CLUTTER_EASE_OUT_QUART

quartic tweening, inverse of CLUTTER_EASE_IN_QUART

CLUTTER_EASE_IN_OUT_QUART

quartic tweening, combining CLUTTER_EASE_IN_QUART and CLUTTER_EASE_OUT_QUART

CLUTTER_EASE_IN_QUINT

quintic tweening

CLUTTER_EASE_OUT_QUINT

quintic tweening, inverse of CLUTTER_EASE_IN_QUINT

CLUTTER_EASE_IN_OUT_QUINT

fifth power tweening, combining CLUTTER_EASE_IN_QUINT and CLUTTER_EASE_OUT_QUINT

CLUTTER_EASE_IN_SINE

sinusoidal tweening

CLUTTER_EASE_OUT_SINE

sinusoidal tweening, inverse of CLUTTER_EASE_IN_SINE

CLUTTER_EASE_IN_OUT_SINE

sine wave tweening, combining CLUTTER_EASE_IN_SINE and CLUTTER_EASE_OUT_SINE

CLUTTER_EASE_IN_EXPO

exponential tweening

CLUTTER_EASE_OUT_EXPO

exponential tweening, inverse of CLUTTER_EASE_IN_EXPO

CLUTTER_EASE_IN_OUT_EXPO

exponential tweening, combining CLUTTER_EASE_IN_EXPO and CLUTTER_EASE_OUT_EXPO

CLUTTER_EASE_IN_CIRC

circular tweening

CLUTTER_EASE_OUT_CIRC

circular tweening, inverse of CLUTTER_EASE_IN_CIRC

CLUTTER_EASE_IN_OUT_CIRC

circular tweening, combining CLUTTER_EASE_IN_CIRC and CLUTTER_EASE_OUT_CIRC

CLUTTER_EASE_IN_ELASTIC

elastic tweening, with offshoot on start

CLUTTER_EASE_OUT_ELASTIC

elastic tweening, with offshoot on end

CLUTTER_EASE_IN_OUT_ELASTIC

elastic tweening with offshoot on both ends

CLUTTER_EASE_IN_BACK

overshooting cubic tweening, with backtracking on start

CLUTTER_EASE_OUT_BACK

overshooting cubic tweening, with backtracking on end

CLUTTER_EASE_IN_OUT_BACK

overshooting cubic tweening, with backtracking on both ends

CLUTTER_EASE_IN_BOUNCE

exponentially decaying parabolic (bounce) tweening, with bounce on start

CLUTTER_EASE_OUT_BOUNCE

exponentially decaying parabolic (bounce) tweening, with bounce on end

CLUTTER_EASE_IN_OUT_BOUNCE

exponentially decaying parabolic (bounce) tweening, with bounce on both ends

CLUTTER_ANIMATION_LAST

last animation mode, used as a guard for registered global alpha functions

Since 1.0


clutter_animation_new ()

ClutterAnimation *  clutter_animation_new               (void);

Creates a new ClutterAnimation instance. You should set the GObject to be animated using clutter_animation_set_object(), set the duration with clutter_animation_set_duration() and the easing mode using clutter_animation_set_mode().

Use clutter_animation_bind() or clutter_animation_bind_interval() to define the properties to be animated. The interval and the animated properties can be updated at runtime.

The clutter_actor_animate() and relative family of functions provide an easy way to animate a ClutterActor and automatically manage the lifetime of a ClutterAnimation instance, so you should consider using those functions instead of manually creating an animation.

Returns :

the newly created ClutterAnimation. Use g_object_ref_sink() to take ownership of the Animation instance, and g_object_unref() to release the associated resources

Since 1.0


clutter_animation_set_object ()

void                clutter_animation_set_object        (ClutterAnimation *animation,
                                                         GObject *object);

Attaches animation to object. The ClutterAnimation will take a reference on object.

animation :

a ClutterAnimation

object :

a GObject

Since 1.0


clutter_animation_get_object ()

GObject *           clutter_animation_get_object        (ClutterAnimation *animation);

Retrieves the GObject attached to animation.

animation :

a ClutterAnimation

Returns :

a GObject. transfer none.

Since 1.0


clutter_animation_set_mode ()

void                clutter_animation_set_mode          (ClutterAnimation *animation,
                                                         gulong mode);

Sets the animation mode of animation. The animation mode is a logical id, either coming from the ClutterAnimationMode enumeration or the return value of clutter_alpha_register_func().

animation :

a ClutterAnimation

mode :

an animation mode logical id

Since 1.0


clutter_animation_get_mode ()

gulong              clutter_animation_get_mode          (ClutterAnimation *animation);

Retrieves the animation mode of animation, as set by clutter_animation_set_mode().

animation :

a ClutterAnimation

Returns :

the mode for the animation

Since 1.0


clutter_animation_set_duration ()

void                clutter_animation_set_duration      (ClutterAnimation *animation,
                                                         gint msecs);

Sets the duration of animation in milliseconds.

animation :

a ClutterAnimation

msecs :

the duration in milliseconds

Since 1.0


clutter_animation_get_duration ()

guint               clutter_animation_get_duration      (ClutterAnimation *animation);

Retrieves the duration of animation, in milliseconds.

animation :

a ClutterAnimation

Returns :

the duration of the animation

Since 1.0


clutter_animation_set_loop ()

void                clutter_animation_set_loop          (ClutterAnimation *animation,
                                                         gboolean loop);

Sets whether animation should loop over itself once finished.

A looping ClutterAnimation will not emit the "completed" signal when finished.

animation :

a ClutterAnimation

loop :

TRUE if the animation should loop

Since 1.0


clutter_animation_get_loop ()

gboolean            clutter_animation_get_loop          (ClutterAnimation *animation);

Retrieves whether animation is looping.

animation :

a ClutterAnimation

Returns :

TRUE if the animation is looping

Since 1.0


clutter_animation_set_timeline ()

void                clutter_animation_set_timeline      (ClutterAnimation *animation,
                                                         ClutterTimeline *timeline);

Sets the ClutterTimeline used by animation.

The "duration" and "loop" properties will be set using the corresponding ClutterTimeline properties as a side effect.

If timeline is NULL a new ClutterTimeline will be constructed using the current values of the "duration" and "loop" properties.

animation :

a ClutterAnimation

timeline :

a ClutterTimeline or NULL

Since 1.0


clutter_animation_get_timeline ()

ClutterTimeline *   clutter_animation_get_timeline      (ClutterAnimation *animation);

Retrieves the ClutterTimeline used by animation

animation :

a ClutterAnimation

Returns :

the timeline used by the animation. transfer none.

Since 1.0


clutter_animation_set_alpha ()

void                clutter_animation_set_alpha         (ClutterAnimation *animation,
                                                         ClutterAlpha *alpha);

Sets alpha as the ClutterAlpha used by animation.

If alpha is NULL, a new ClutterAlpha will be constructed from the current values of the "mode" and "timeline" properties.

animation :

a ClutterAnimation

alpha :

a ClutterAlpha, or NULL

Since 1.0


clutter_animation_get_alpha ()

ClutterAlpha *      clutter_animation_get_alpha         (ClutterAnimation *animation);

Retrieves the ClutterAlpha used by animation.

animation :

a ClutterAnimation

Returns :

the alpha object used by the animation. transfer none.

Since 1.0


clutter_animation_completed ()

void                clutter_animation_completed         (ClutterAnimation *animation);

Emits the ::completed signal on animation. After this function terminates animation will be unreferenced and it will not be valid anymore, unless g_object_ref() was called before

animation :

a ClutterAnimation

Since 1.0


clutter_animation_bind ()

ClutterAnimation *  clutter_animation_bind              (ClutterAnimation *animation,
                                                         const gchar *property_name,
                                                         const GValue *final);

Adds a single property with name property_name to the animation animation. For more information about animations, see clutter_actor_animate().

This method returns the animation primarily to make chained calls convenient in language bindings.

animation :

a ClutterAnimation

property_name :

the property to control

final :

The final value of the property

Returns :

The animation itself.. transfer none.

Since 1.0


clutter_animation_bind_interval ()

ClutterAnimation *  clutter_animation_bind_interval     (ClutterAnimation *animation,
                                                         const gchar *property_name,
                                                         ClutterInterval *interval);

Binds interval to the property_name of the GObject attached to animation. The ClutterAnimation will take ownership of the passed ClutterInterval. For more information about animations, see clutter_actor_animate().

If you need to update the interval instance use clutter_animation_update_property() instead.

animation :

a ClutterAnimation

property_name :

the property to control

interval :

a ClutterInterval. transfer full.

Returns :

The animation itself.. transfer none.

Since 1.0


clutter_animation_update_interval ()

void                clutter_animation_update_interval   (ClutterAnimation *animation,
                                                         const gchar *property_name,
                                                         ClutterInterval *interval);

Changes the interval for property_name. The ClutterAnimation will take ownership of the passed ClutterInterval.

animation :

a ClutterAnimation

property_name :

name of the property

interval :

a ClutterInterval

Since 1.0


clutter_animation_has_property ()

gboolean            clutter_animation_has_property      (ClutterAnimation *animation,
                                                         const gchar *property_name);

Checks whether animation is controlling property_name.

animation :

a ClutterAnimation

property_name :

name of the property

Returns :

TRUE if the property is animated by the ClutterAnimation, FALSE otherwise

Since 1.0


clutter_animation_unbind_property ()

void                clutter_animation_unbind_property   (ClutterAnimation *animation,
                                                         const gchar *property_name);

Removes property_name from the list of animated properties.

animation :

a ClutterAnimation

property_name :

name of the property

Since 1.0


clutter_animation_get_interval ()

ClutterInterval *   clutter_animation_get_interval      (ClutterAnimation *animation,
                                                         const gchar *property_name);

Retrieves the ClutterInterval associated to property_name inside animation.

animation :

a ClutterAnimation

property_name :

name of the property

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_animate ()

ClutterAnimation *  clutter_actor_animate               (ClutterActor *actor,
                                                         gulong mode,
                                                         guint duration,
                                                         const gchar *first_property_name,
                                                         ...);

Animates the given list of properties of actor between the current value for each property and a new final value. The animation has a definite duration and a speed given by the mode.

For example, this:

  clutter_actor_animate (rectangle, CLUTTER_LINEAR, 250,
                         "width", 100,
                         "height", 100,
                         NULL);

will make width and height properties of the ClutterActor "rectangle" grow linearly between the current value and 100 pixels, in 250 milliseconds.

The animation mode is a logical id, either from the ClutterAnimationMode enumeration of from clutter_alpha_register_func().

All the properties specified will be animated between the current value and the final value. If a property should be set at the beginning of the animation but not updated during the animation, it should be prefixed by the "fixed::" string, for instance:

  clutter_actor_animate (actor, CLUTTER_EASE_IN, 100,
                         "rotation-angle-z", 360,
                         "fixed::rotation-center-z", &center,
                         NULL);

Will animate the "rotation-angle-z" property between the current value and 360 degrees, and set the "rotation-center-z" property to the fixed value of the ClutterVertex "center".

This function will implicitly create a ClutterAnimation object which will be assigned to the actor and will be returned to the developer to control the animation or to know when the animation has been completed.

Calling this function on an actor that is already being animated will cause the current animation to change with the new final values, the new easing mode and the new duration - that is, this code:

  clutter_actor_animate (actor, 250, CLUTTER_LINEAR,
                         "width", 100,
                         "height", 100,
                         NULL);
  clutter_actor_animate (actor, 500, CLUTTER_EASE_IN_CUBIC,
                         "x", 100,
                         "y", 100,
                         "width", 200,
                         NULL);

is the equivalent of:

  clutter_actor_animate (actor, 500, CLUTTER_EASE_IN_CUBIC,
                         "x", 100,
                         "y", 100,
                         "width", 200,
                         "height", 100,
                         NULL);

Note

Unless the animation is looping, it will become invalid as soon as it is complete. To avoid this, you should keep a reference on the returned value using g_object_ref(). If you want to keep the animation alive across multiple cycles, you also have to add a reference each time the "completed" signal is emitted.

actor :

a ClutterActor

mode :

an animation mode logical id

duration :

duration of the animation, in milliseconds

first_property_name :

the name of a property

... :

a NULL terminated list of property names and property values

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_animate_with_timeline ()

ClutterAnimation *  clutter_actor_animate_with_timeline (ClutterActor *actor,
                                                         gulong mode,
                                                         ClutterTimeline *timeline,
                                                         const gchar *first_property_name,
                                                         ...);

Animates the given list of properties of actor between the current value for each property and a new final value. The animation has a definite duration given by timeline and a speed given by the mode.

See clutter_actor_animate() for further details.

This function is useful if you want to use an existing timeline to animate actor.

actor :

a ClutterActor

mode :

an animation mode logical id

timeline :

a ClutterTimeline

first_property_name :

the name of a property

... :

a NULL terminated list of property names and property values

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_animate_with_alpha ()

ClutterAnimation *  clutter_actor_animate_with_alpha    (ClutterActor *actor,
                                                         ClutterAlpha *alpha,
                                                         const gchar *first_property_name,
                                                         ...);

Animates the given list of properties of actor between the current value for each property and a new final value. The animation has a definite behaviour given by the passed alpha.

See clutter_actor_animate() for further details.

This function is useful if you want to use an existing ClutterAlpha to animate actor.

actor :

a ClutterActor

alpha :

a ClutterAlpha

first_property_name :

the name of a property

... :

a NULL terminated list of property names and property values

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_animatev ()

ClutterAnimation *  clutter_actor_animatev              (ClutterActor *actor,
                                                         gulong mode,
                                                         guint duration,
                                                         gint n_properties,
                                                         const gchar * const properties[],
                                                         const GValue *values);

Animates the given list of properties of actor between the current value for each property and a new final value. The animation has a definite duration and a speed given by the mode.

This is the vector-based variant of clutter_actor_animate(), useful for language bindings.

actor :

a ClutterActor

mode :

an animation mode logical id

duration :

duration of the animation, in milliseconds

n_properties :

number of property names and values

properties :

array length=n_properties. array length=n_properties.

values :

array length=n_properies. array length=n_properies.

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_animate_with_timelinev ()

ClutterAnimation *  clutter_actor_animate_with_timelinev
                                                        (ClutterActor *actor,
                                                         gulong mode,
                                                         ClutterTimeline *timeline,
                                                         gint n_properties,
                                                         const gchar * const properties[],
                                                         const GValue *values);

Animates the given list of properties of actor between the current value for each property and a new final value. The animation has a definite duration given by timeline and a speed given by the mode.

See clutter_actor_animate() for further details.

This function is useful if you want to use an existing timeline to animate actor.

This is the vector-based variant of clutter_actor_animate_with_timeline(), useful for language bindings.

actor :

a ClutterActor

mode :

an animation mode logical id

timeline :

a ClutterTimeline

n_properties :

number of property names and values

properties :

array length=n_properties. array length=n_properties.

values :

array length=n_properies. array length=n_properies.

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_animate_with_alphav ()

ClutterAnimation *  clutter_actor_animate_with_alphav   (ClutterActor *actor,
                                                         ClutterAlpha *alpha,
                                                         gint n_properties,
                                                         const gchar * const properties[],
                                                         const GValue *values);

Animates the given list of properties of actor between the current value for each property and a new final value. The animation has a definite behaviour given by the passed alpha.

See clutter_actor_animate() for further details.

This function is useful if you want to use an existing ClutterAlpha to animate actor.

This is the vector-based variant of clutter_actor_animate_with_alpha(), useful for language bindings.

actor :

a ClutterActor

alpha :

a ClutterAlpha

n_properties :

number of property names and values

properties :

array length=n_properties. array length=n_properties.

values :

array length=n_properies. array length=n_properies.

Returns :

transfer none. transfer none.

Since 1.0


clutter_actor_get_animation ()

ClutterAnimation *  clutter_actor_get_animation         (ClutterActor *actor);

Retrieves the ClutterAnimation used by actor, if clutter_actor_animate() has been called on actor.

actor :

a ClutterActor

Returns :

a ClutterAnimation, or NULL. transfer none.

Since 1.0