/usr/share/gtk-doc/html/clutter/migrating-ClutterBehaviour.html is in libclutter-1.0-doc 1.20.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Clutter Reference Manual: Migrating from ClutterBehaviour</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Clutter Reference Manual">
<link rel="up" href="migration.html" title="Part VIII. Migrating from previous version of Clutter">
<link rel="prev" href="using-cairo.html" title="Integration with Cairo">
<link rel="next" href="migrating-ClutterAnimation.html" title="Migrating from ClutterAnimation">
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="migration.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="using-cairo.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="migrating-ClutterAnimation.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div>
<div><h2 class="title">
<a name="migrating-ClutterBehaviour"></a>Migrating from ClutterBehaviour</h2></div>
<div><div class="author">
<h3 class="author">
<span class="firstname">Emmanuele</span> <span class="surname">Bassi</span>
</h3>
<div class="affiliation"><div class="address"><p><br>
<code class="email"><<a class="email" href="mailto:ebassilinux.intel.com">ebassi<em class="parameter"><code>linux.intel.com</code></em></a>></code><br>
</p></div></div>
</div></div>
</div></div>
<p>The <a class="link" href="ClutterBehaviour.html" title="ClutterBehaviour"><span class="type">ClutterBehaviour</span></a> class and its sub-classes have been deprecated
since Clutter 1.6. The animation framework provided by <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation"><span class="type">ClutterAnimation</span></a>,
<a class="link" href="ClutterAnimator.html" title="ClutterAnimator"><span class="type">ClutterAnimator</span></a> and <a class="link" href="ClutterState.html" title="ClutterState"><span class="type">ClutterState</span></a> fully replaces all functionality from the
<a class="link" href="ClutterBehaviour.html" title="ClutterBehaviour"><span class="type">ClutterBehaviour</span></a> classes.</p>
<p>Generally, animations using <a class="link" href="ClutterBehaviour.html" title="ClutterBehaviour"><span class="type">ClutterBehaviour</span></a> sub-classes can be
effectively re-implemented just by using <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> properties.</p>
<p>Here is an example of an animation using a
<a class="link" href="ClutterBehaviourOpacity.html" title="ClutterBehaviourOpacity"><span class="type">ClutterBehaviourOpacity</span></a> instance:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7</pre></td>
<td class="listing_code"><pre class="programlisting">ClutterTimeline <span class="gtkdoc opt">*</span>timeline <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterTimeline.html#clutter-timeline-new">clutter_timeline_new</a></span> <span class="gtkdoc opt">(</span><span class="number">250</span><span class="gtkdoc opt">);</span>
ClutterAlpha <span class="gtkdoc opt">*</span>alpha <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterAlpha.html#clutter-alpha-new-full">clutter_alpha_new_full</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">,</span> CLUTTER_LINEAR<span class="gtkdoc opt">);</span>
ClutterBehaviour <span class="gtkdoc opt">*</span>behaviour <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterBehaviourOpacity.html#clutter-behaviour-opacity-new">clutter_behaviour_opacity_new</a></span> <span class="gtkdoc opt">(</span>alpha<span class="gtkdoc opt">,</span> <span class="number">255</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterBehaviour.html#clutter-behaviour-apply">clutter_behaviour_apply</a></span> <span class="gtkdoc opt">(</span>behaviour<span class="gtkdoc opt">,</span> some_actor<span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterTimeline.html#clutter-timeline-start">clutter_timeline_start</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>The same effect can be achieved by using <a class="link" href="clutter-Implicit-Animations.html#clutter-actor-animate" title="clutter_actor_animate ()"><code class="function">clutter_actor_animate()</code></a> and
the <a class="link" href="ClutterActor.html#ClutterActor--opacity" title="The “opacity” property"><span class="type">“opacity”</span></a> property:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="ClutterActor.html#clutter-actor-set-opacity">clutter_actor_set_opacity</a></span> <span class="gtkdoc opt">(</span>some_actor<span class="gtkdoc opt">,</span> <span class="number">255</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="clutter-Implicit-Animations.html#clutter-actor-animate">clutter_actor_animate</a></span> <span class="gtkdoc opt">(</span>some_actor<span class="gtkdoc opt">,</span> CLUTTER_LINEAR<span class="gtkdoc opt">,</span> <span class="number">250</span><span class="gtkdoc opt">,</span>
<span class="string">"opacity"</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span>
NULL<span class="gtkdoc opt">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p><a class="link" href="ClutterBehaviour.html" title="ClutterBehaviour"><span class="type">ClutterBehaviour</span></a>s used for continuous animations with looping
timelines can still be effectively replaced by looping animations; for
instance, the following example of a "pulsating" actor using
<a class="link" href="ClutterBehaviourScale.html" title="ClutterBehaviourScale"><span class="type">ClutterBehaviourScale</span></a>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static void</span>
<span class="function">reverse_timeline</span> <span class="gtkdoc opt">(</span>ClutterTimeline <span class="gtkdoc opt">*</span>timeline<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
ClutterTimelineDirection dir <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterTimeline.html#clutter-timeline-get-direction">clutter_timeline_get_direction</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">);</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(</span>dir <span class="gtkdoc opt">==</span> CLUTTER_TIMELINE_FORWARD<span class="gtkdoc opt">)</span>
dir <span class="gtkdoc opt">=</span> CLUTTER_TIMELINE_BACKWARD<span class="gtkdoc opt">;</span>
<span class="keyword">else</span>
dir <span class="gtkdoc opt">=</span> CLUTTER_TIMELINE_FORWARD<span class="gtkdoc opt">;</span>
<span class="function"><a href="ClutterTimeline.html#clutter-timeline-set-direction">clutter_timeline_set_direction</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">,</span> dir<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>
ClutterTimeline <span class="gtkdoc opt">*</span>timeline <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterTimeline.html#clutter-timeline-new">clutter_timeline_new</a></span> <span class="gtkdoc opt">(</span><span class="number">500</span><span class="gtkdoc opt">);</span>
ClutterAlpha <span class="gtkdoc opt">*</span>alpha <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterAlpha.html#clutter-alpha-new-full">clutter_alpha_new_full</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">,</span> CLUTTER_LINEAR<span class="gtkdoc opt">);</span>
ClutterBehaviour <span class="gtkdoc opt">*</span>behaviour<span class="gtkdoc opt">;</span>
<span class="function">g_object_set</span> <span class="gtkdoc opt">(</span>some_actor<span class="gtkdoc opt">,</span> <span class="string">"scale-gravity"</span><span class="gtkdoc opt">,</span> CLUTTER_GRAVITY_CENTER<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
behaviour <span class="gtkdoc opt">=</span> <span class="function"><a href="ClutterBehaviourScale.html#clutter-behaviour-scale-new">clutter_behaviour_scale_new</a></span> <span class="gtkdoc opt">(</span>alpha<span class="gtkdoc opt">,</span>
<span class="number">1.0</span><span class="gtkdoc opt">,</span> <span class="number">2.0</span><span class="gtkdoc opt">,</span>
<span class="number">1.0</span><span class="gtkdoc opt">,</span> <span class="number">2.0</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterBehaviour.html#clutter-behaviour-apply">clutter_behaviour_apply</a></span> <span class="gtkdoc opt">(</span>behaviour<span class="gtkdoc opt">,</span> some_actor<span class="gtkdoc opt">);</span>
<span class="function">g_signal_connect</span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">,</span>
<span class="string">"completed"</span><span class="gtkdoc opt">,</span> <span class="function">G_CALLBACK</span> <span class="gtkdoc opt">(</span>reverse_timeline<span class="gtkdoc opt">),</span>
NULL<span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterTimeline.html#clutter-timeline-set-loop">clutter_timeline_set_loop</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterTimeline.html#clutter-timeline-start">clutter_timeline_start</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>The same effect can be achieved using a <a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation"><span class="type">ClutterAnimation</span></a>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10</pre></td>
<td class="listing_code"><pre class="programlisting">ClutterAnimation <span class="gtkdoc opt">*</span>animation <span class="gtkdoc opt">=</span>
<span class="function"><a href="clutter-Implicit-Animations.html#clutter-actor-animate">clutter_actor_animate</a></span> <span class="gtkdoc opt">(</span>some_actor<span class="gtkdoc opt">,</span> CLUTTER_LINEAR<span class="gtkdoc opt">,</span> <span class="number">500</span><span class="gtkdoc opt">,</span>
<span class="string">"scale-x"</span><span class="gtkdoc opt">,</span> <span class="number">2.0</span><span class="gtkdoc opt">,</span>
<span class="string">"scale-y"</span><span class="gtkdoc opt">,</span> <span class="number">2.0</span><span class="gtkdoc opt">,</span>
<span class="string">"fixed::scale-gravity"</span><span class="gtkdoc opt">,</span> CLUTTER_GRAVITY_CENTER<span class="gtkdoc opt">,</span>
NULL<span class="gtkdoc opt">);</span>
ClutterTimeline <span class="gtkdoc opt">*</span>timeline <span class="gtkdoc opt">=</span> <span class="function"><a href="clutter-Implicit-Animations.html#clutter-animation-get-timeline">clutter_animation_get_timeline</a></span> <span class="gtkdoc opt">(</span>animation<span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterTimeline.html#clutter-timeline-set-repeat-count">clutter_timeline_set_repeat_count</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="ClutterTimeline.html#clutter-timeline-set-auto-reverse">clutter_timeline_set_auto_reverse</a></span> <span class="gtkdoc opt">(</span>timeline<span class="gtkdoc opt">,</span> TRUE<span class="gtkdoc opt">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p><a class="link" href="ClutterBehaviour.html" title="ClutterBehaviour"><span class="type">ClutterBehaviour</span></a> sub-classes can be applied to multiple actors, in
order to share the duration and the easing mode. It is possible to use the
same underlying <a class="link" href="ClutterTimeline.html" title="ClutterTimeline"><span class="type">ClutterTimeline</span></a> and <a class="link" href="ClutterAlpha.html" title="ClutterAlpha"><span class="type">ClutterAlpha</span></a> instances with
<a class="link" href="clutter-Implicit-Animations.html#ClutterAnimation"><span class="type">ClutterAnimation</span></a> to achieve the same effect. Complex animations, spanning
multiple actors, should use the <a class="link" href="ClutterAnimator.html" title="ClutterAnimator"><span class="type">ClutterAnimator</span></a> and <a class="link" href="ClutterState.html" title="ClutterState"><span class="type">ClutterState</span></a> classes
instead.</p>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.21</div>
</body>
</html>
|