## Implicit Animations

Using behaviours for simple animations of a single actor may be too complicated, in terms of memory management and bookkeeping of the object instances. For this reason, Clutter also provides a simple animation API for implicit animations using properties of an actor: `clutter_actor_animate()`.

The `clutter_actor_animate()` family of functions will create and use an implicit ClutterAnimation instance, which will then handle the animation of one or more ClutterActor properties between a range of values.

Example 29. Using `clutter_actor_animate()`

The following example demonstrates how to use the `clutter_actor_animate()` method to tween an actor between the current position and a new set of coordinates. The animation takes 200 milliseconds to complete and uses a linear progression.

      clutter_actor_animate (actor, CLUTTER_LINEAR, 200,
                             "x", 200.0f,
                             "y", 200.0f,
                             NULL);

The `clutter_actor_animate()` method returns a ClutterAnimation instance that can be used to start, stop and modify the animation while it's running. The "completed" signal will be emitted when the animation has been completed.

### Warning

When the animation is complete it will be automatically unreferenced, and disposed if nothing else is holding a reference on it.

Example 30. Animating inside an event handler

The following example demonstrates how to animate an actor inside the signal handler for a button press event. If the user presses the button on a new position while the animation is running, the animation will be restarted with the new final values updated.

      static gboolean
      on_button_press (ClutterActor *actor,
                       ClutterEvent *event,
                       gpointer      user_data)
      {
        gfloat event_x, event_y;

        clutter_event_get_coords (event, &event_x, &event_y);
        clutter_actor_animate (actor, CLUTTER_EASE_SINE_OUT, 500,
                               "x", event_x,
                               "y", event_y,
                               NULL);
        return TRUE;
      }

Calling `clutter_actor_animate()` multiple times on an actor which is being animated will cause the animation to be updated with the new values.

If you need to chain up multiple animations created using `clutter_actor_animate()` you should connect to the "completed" signal using `g_signal_connect_after()` to have the guarantee that the current ClutterAnimation has been detached from the actor. The documentation for `clutter_actor_animate()` has further examples.