1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Implicit Animations</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="Clutter Reference Manual">
8 <link rel="up" href="clutter-animations.html" title="Creating Animations with Clutter">
9 <link rel="prev" href="clutter-animation-timelines.html" title="Timelines">
10 <link rel="next" href="clutter-animation-conclusion.html" title="Conclusion">
11 <meta name="generator" content="GTK-Doc V1.18.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
16 <td><a accesskey="p" href="clutter-animation-timelines.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
17 <td><a accesskey="u" href="clutter-animations.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
18 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19 <th width="100%" align="center">Clutter Reference Manual</th>
20 <td><a accesskey="n" href="clutter-animation-conclusion.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
24 <a name="clutter-animation-implicit"></a>Implicit Animations</h2></div></div></div>
25 <p>Using behaviours for simple animations of a single actor may
26 be too complicated, in terms of memory management and bookkeeping
27 of the object instances. For this reason, Clutter also provides a
28 simple animation API for implicit animations using properties of
29 an actor: <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a>.</p>
30 <p>The <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a> family of functions will create
31 and use an implicit <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation"><span class="type">ClutterAnimation</span></a> instance, which will then
32 handle the animation of one or more <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> properties between
33 a range of values.</p>
35 <a name="clutter-actor-animate-example"></a><p class="title"><b>Example 20. Using <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a></b></p>
36 <div class="example-contents">
37 <p>The following example demonstrates how to use the
38 <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a> method to tween an actor between the current
39 position and a new set of coordinates. The animation takes 200
40 milliseconds to complete and uses a linear progression.</p>
41 <pre class="programlisting">
42 clutter_actor_animate (actor, CLUTTER_LINEAR, 200,
49 <br class="example-break"><p>The <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a> method returns a <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation"><span class="type">ClutterAnimation</span></a>
50 instance that can be used to start, stop and modify the animation
51 while it's running. The <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation-completed" title='The "completed" signal'><span class="type">"completed"</span></a> signal will
52 be emitted when the animation has been completed.</p>
53 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
54 <h3 class="title">Warning</h3>
55 <p>When the animation is complete it will be automatically
56 unreferenced, and disposed if nothing else is holding a reference
60 <a name="clutter-actor-animate-multi-example"></a><p class="title"><b>Example 21. Animating inside an event handler</b></p>
61 <div class="example-contents">
62 <p>The following example demonstrates how to animate an actor
63 inside the signal handler for a button press event. If the user
64 presses the button on a new position while the animation is running,
65 the animation will be restarted with the new final values
67 <pre class="programlisting">
69 on_button_press (ClutterActor *actor,
73 gfloat event_x, event_y;
75 clutter_event_get_coords (event, &event_x, &event_y);
76 clutter_actor_animate (actor, CLUTTER_EASE_SINE_OUT, 500,
85 <br class="example-break"><p>Calling <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a> multiple times on an
86 actor which is being animated will cause the animation to be updated
87 with the new values.</p>
88 <p>If you need to chain up multiple animations created using
89 <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a> you should connect to the
90 <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation-completed" title='The "completed" signal'><span class="type">"completed"</span></a> signal using <code class="function">g_signal_connect_after()</code>
91 to have the guarantee that the current <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation"><span class="type">ClutterAnimation</span></a> has been
92 detached from the actor. The documentation for <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a>
93 has further examples.</p>
97 Generated by GTK-Doc V1.18.1</div>