2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
4
<!ENTITY version "1.0.8">
7
<refentry id="ClutterBehaviourPath">
9
<refentrytitle role="top_of_page" id="ClutterBehaviourPath.top_of_page">ClutterBehaviourPath</refentrytitle>
10
<manvolnum>3</manvolnum>
11
<refmiscinfo>CLUTTER Library</refmiscinfo>
15
<refname>ClutterBehaviourPath</refname>
16
<refpurpose>A behaviour for moving actors along a <link linkend="ClutterPath"><type>ClutterPath</type></link></refpurpose>
19
<refsynopsisdiv id="ClutterBehaviourPath.synopsis" role="synopsis">
20
<title role="synopsis.title">Synopsis</title>
23
<link linkend="ClutterBehaviourPath-struct">ClutterBehaviourPath</link>;
24
<link linkend="ClutterBehaviourPathClass">ClutterBehaviourPathClass</link>;
25
<link linkend="ClutterBehaviour">ClutterBehaviour</link> * <link linkend="clutter-behaviour-path-new">clutter_behaviour_path_new</link> (<link linkend="ClutterAlpha">ClutterAlpha</link> *alpha,
26
<link linkend="ClutterPath">ClutterPath</link> *path);
27
<link linkend="ClutterBehaviour">ClutterBehaviour</link> * <link linkend="clutter-behaviour-path-new-with-description">clutter_behaviour_path_new_with_description</link>
28
(<link linkend="ClutterAlpha">ClutterAlpha</link> *alpha,
29
const <link linkend="gchar">gchar</link> *desc);
30
<link linkend="ClutterBehaviour">ClutterBehaviour</link> * <link linkend="clutter-behaviour-path-new-with-knots">clutter_behaviour_path_new_with_knots</link>
31
(<link linkend="ClutterAlpha">ClutterAlpha</link> *alpha,
32
const <link linkend="ClutterKnot">ClutterKnot</link> *knots,
33
<link linkend="guint">guint</link> n_knots);
34
<link linkend="void">void</link> <link linkend="clutter-behaviour-path-set-path">clutter_behaviour_path_set_path</link> (<link linkend="ClutterBehaviourPath">ClutterBehaviourPath</link> *pathb,
35
<link linkend="ClutterPath">ClutterPath</link> *path);
36
<link linkend="ClutterPath">ClutterPath</link> * <link linkend="clutter-behaviour-path-get-path">clutter_behaviour_path_get_path</link> (<link linkend="ClutterBehaviourPath">ClutterBehaviourPath</link> *pathb);
38
<link linkend="ClutterKnot">ClutterKnot</link>;
39
<link linkend="ClutterKnot">ClutterKnot</link> * <link linkend="clutter-knot-copy">clutter_knot_copy</link> (const <link linkend="ClutterKnot">ClutterKnot</link> *knot);
40
<link linkend="void">void</link> <link linkend="clutter-knot-free">clutter_knot_free</link> (<link linkend="ClutterKnot">ClutterKnot</link> *knot);
41
<link linkend="gboolean">gboolean</link> <link linkend="clutter-knot-equal">clutter_knot_equal</link> (const <link linkend="ClutterKnot">ClutterKnot</link> *knot_a,
42
const <link linkend="ClutterKnot">ClutterKnot</link> *knot_b);
46
<refsect1 id="ClutterBehaviourPath.object-hierarchy" role="object_hierarchy">
47
<title role="object_hierarchy.title">Object Hierarchy</title>
49
<link linkend="GObject">GObject</link>
50
+----<link linkend="ClutterBehaviour">ClutterBehaviour</link>
51
+----ClutterBehaviourPath
57
<refsect1 id="ClutterBehaviourPath.implemented-interfaces" role="impl_interfaces">
58
<title role="impl_interfaces.title">Implemented Interfaces</title>
60
ClutterBehaviourPath implements
61
<link linkend="ClutterScriptable">ClutterScriptable</link>.</para>
65
<refsect1 id="ClutterBehaviourPath.properties" role="properties">
66
<title role="properties.title">Properties</title>
68
"<link linkend="ClutterBehaviourPath--path">path</link>" <link linkend="ClutterPath">ClutterPath</link>* : Read / Write
72
<refsect1 id="ClutterBehaviourPath.signals" role="signal_proto">
73
<title role="signal_proto.title">Signals</title>
75
"<link linkend="ClutterBehaviourPath-knot-reached">knot-reached</link>" : Run Last
80
<refsect1 id="ClutterBehaviourPath.description" role="desc">
81
<title role="desc.title">Description</title>
83
<link linkend="ClutterBehaviourPath"><type>ClutterBehaviourPath</type></link> interpolates actors along a defined path.
86
A path is described by a <link linkend="ClutterPath"><type>ClutterPath</type></link> object. The path can contain
87
straight line parts and bezier curves. If the path contains
88
<link linkend="CLUTTER-PATH-MOVE-TO--CAPS"><literal>CLUTTER_PATH_MOVE_TO</literal></link> parts then the actors will jump to those
89
coordinates. This can be used make disjoint paths.
92
When creating a path behaviour in a <link linkend="ClutterScript"><type>ClutterScript</type></link>, you can specify
93
the path property directly as a string. For example:
96
<informalexample><programlisting>
99
"type" : "ClutterBehaviourPath",
100
"path" : "M 50 50 L 100 100",
102
"timeline" : "main-timeline",
106
</programlisting></informalexample>
109
<note>If the alpha function is a periodic function, i.e. it returns to
110
0 after reaching <link linkend="CLUTTER-ALPHA-MAX-ALPHA--CAPS"><literal>CLUTTER_ALPHA_MAX_ALPHA</literal></link>, then the actors will walk
111
the path back to the starting <link linkend="ClutterKnot"><type>ClutterKnot</type></link>.</note>
114
<link linkend="ClutterBehaviourPath"><type>ClutterBehaviourPath</type></link> is available since Clutter 0.2</para>
119
<refsect1 id="ClutterBehaviourPath.details" role="details">
120
<title role="details.title">Details</title>
121
<refsect2 id="ClutterBehaviourPath-struct" role="struct">
122
<title>ClutterBehaviourPath</title>
123
<indexterm zone="ClutterBehaviourPath-struct" role="0.2"><primary sortas="BehaviourPath">ClutterBehaviourPath</primary></indexterm><programlisting>typedef struct _ClutterBehaviourPath ClutterBehaviourPath;</programlisting>
125
The <link linkend="ClutterBehaviourPath"><type>ClutterBehaviourPath</type></link> structure contains only private data
126
and should be accessed using the provided API</para>
128
</para><para role="since">Since 0.2</para></refsect2>
129
<refsect2 id="ClutterBehaviourPathClass" role="struct">
130
<title>ClutterBehaviourPathClass</title>
131
<indexterm zone="ClutterBehaviourPathClass"><primary sortas="BehaviourPathClass">ClutterBehaviourPathClass</primary></indexterm><programlisting>typedef struct {
132
void (*knot_reached) (ClutterBehaviourPath *pathb,
134
} ClutterBehaviourPathClass;
137
The <link linkend="ClutterBehaviourPathClass"><type>ClutterBehaviourPathClass</type></link> struct contains only private data
142
</para><variablelist role="struct">
144
<term><structfield>knot_reached</structfield> ()</term>
145
<listitem><simpara> signal class handler for the
146
ClutterBehaviourPath::knot_reached signal
147
</simpara></listitem>
149
</variablelist></refsect2>
150
<refsect2 id="clutter-behaviour-path-new" role="function" condition="since:0.2">
151
<title>clutter_behaviour_path_new ()</title>
152
<indexterm zone="clutter-behaviour-path-new" role="0.2"><primary sortas="behaviour_path_new">clutter_behaviour_path_new</primary></indexterm><programlisting><link linkend="ClutterBehaviour">ClutterBehaviour</link> * clutter_behaviour_path_new (<link linkend="ClutterAlpha">ClutterAlpha</link> *alpha,
153
<link linkend="ClutterPath">ClutterPath</link> *path);</programlisting>
155
Creates a new path behaviour. You can use this behaviour to drive
156
actors along the nodes of a path, described by <parameter>path</parameter>.
159
This will claim the floating reference on the <link linkend="ClutterPath"><type>ClutterPath</type></link> so you
160
do not need to unref if it.</para>
162
</para><variablelist role="params">
163
<varlistentry><term><parameter>alpha</parameter> :</term>
164
<listitem><simpara> a <link linkend="ClutterAlpha"><type>ClutterAlpha</type></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
165
</simpara></listitem></varlistentry>
166
<varlistentry><term><parameter>path</parameter> :</term>
167
<listitem><simpara> a <link linkend="ClutterPath"><type>ClutterPath</type></link> or <link linkend="NULL--CAPS"><literal>NULL</literal></link> for an empty path
168
</simpara></listitem></varlistentry>
169
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="ClutterBehaviour"><type>ClutterBehaviour</type></link>
171
</simpara></listitem></varlistentry>
172
</variablelist><para role="since">Since 0.2</para></refsect2>
173
<refsect2 id="clutter-behaviour-path-new-with-description" role="function" condition="since:1.0">
174
<title>clutter_behaviour_path_new_with_description ()</title>
175
<indexterm zone="clutter-behaviour-path-new-with-description" role="1.0"><primary sortas="behaviour_path_new_with_description">clutter_behaviour_path_new_with_description</primary></indexterm><programlisting><link linkend="ClutterBehaviour">ClutterBehaviour</link> * clutter_behaviour_path_new_with_description
176
(<link linkend="ClutterAlpha">ClutterAlpha</link> *alpha,
177
const <link linkend="gchar">gchar</link> *desc);</programlisting>
179
Creates a new path behaviour using the path described by <parameter>desc</parameter>. See
180
<link linkend="clutter-path-add-string"><function>clutter_path_add_string()</function></link> for a description of the format.</para>
182
</para><variablelist role="params">
183
<varlistentry><term><parameter>alpha</parameter> :</term>
184
<listitem><simpara> a <link linkend="ClutterAlpha"><type>ClutterAlpha</type></link>
185
</simpara></listitem></varlistentry>
186
<varlistentry><term><parameter>desc</parameter> :</term>
187
<listitem><simpara> a string description of the path
188
</simpara></listitem></varlistentry>
189
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="ClutterBehaviour"><type>ClutterBehaviour</type></link>
191
</simpara></listitem></varlistentry>
192
</variablelist><para role="since">Since 1.0</para></refsect2>
193
<refsect2 id="clutter-behaviour-path-new-with-knots" role="function" condition="since:1.0">
194
<title>clutter_behaviour_path_new_with_knots ()</title>
195
<indexterm zone="clutter-behaviour-path-new-with-knots" role="1.0"><primary sortas="behaviour_path_new_with_knots">clutter_behaviour_path_new_with_knots</primary></indexterm><programlisting><link linkend="ClutterBehaviour">ClutterBehaviour</link> * clutter_behaviour_path_new_with_knots
196
(<link linkend="ClutterAlpha">ClutterAlpha</link> *alpha,
197
const <link linkend="ClutterKnot">ClutterKnot</link> *knots,
198
<link linkend="guint">guint</link> n_knots);</programlisting>
200
Creates a new path behaviour that will make the actors visit all of
201
the given knots in order with straight lines in between.
204
A path will be created where the first knot is used in a
205
<link linkend="CLUTTER-PATH-MOVE-TO--CAPS"><literal>CLUTTER_PATH_MOVE_TO</literal></link> and the subsequent knots are used in
206
<link linkend="CLUTTER-PATH-LINE-TO--CAPS"><literal>CLUTTER_PATH_LINE_TO</literal></link><!-- -->s.</para>
208
</para><variablelist role="params">
209
<varlistentry><term><parameter>alpha</parameter> :</term>
210
<listitem><simpara> a <link linkend="ClutterAlpha"><type>ClutterAlpha</type></link>
211
</simpara></listitem></varlistentry>
212
<varlistentry><term><parameter>knots</parameter> :</term>
213
<listitem><simpara> an array of <link linkend="ClutterKnot"><type>ClutterKnot</type></link><!-- -->s
214
</simpara></listitem></varlistentry>
215
<varlistentry><term><parameter>n_knots</parameter> :</term>
216
<listitem><simpara> number of entries in <parameter>knots</parameter>
217
</simpara></listitem></varlistentry>
218
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="ClutterBehaviour"><type>ClutterBehaviour</type></link>
220
</simpara></listitem></varlistentry>
221
</variablelist><para role="since">Since 1.0</para></refsect2>
222
<refsect2 id="clutter-behaviour-path-set-path" role="function" condition="since:1.0">
223
<title>clutter_behaviour_path_set_path ()</title>
224
<indexterm zone="clutter-behaviour-path-set-path" role="1.0"><primary sortas="behaviour_path_set_path">clutter_behaviour_path_set_path</primary></indexterm><programlisting><link linkend="void">void</link> clutter_behaviour_path_set_path (<link linkend="ClutterBehaviourPath">ClutterBehaviourPath</link> *pathb,
225
<link linkend="ClutterPath">ClutterPath</link> *path);</programlisting>
227
Change the path that the actors will follow. This will take the
228
floating reference on the <link linkend="ClutterPath"><type>ClutterPath</type></link> so you do not need to unref
231
</para><variablelist role="params">
232
<varlistentry><term><parameter>pathb</parameter> :</term>
233
<listitem><simpara> the path behaviour
234
</simpara></listitem></varlistentry>
235
<varlistentry><term><parameter>path</parameter> :</term>
236
<listitem><simpara> the new path to follow
237
</simpara></listitem></varlistentry>
238
</variablelist><para role="since">Since 1.0</para></refsect2>
239
<refsect2 id="clutter-behaviour-path-get-path" role="function" condition="since:1.0">
240
<title>clutter_behaviour_path_get_path ()</title>
241
<indexterm zone="clutter-behaviour-path-get-path" role="1.0"><primary sortas="behaviour_path_get_path">clutter_behaviour_path_get_path</primary></indexterm><programlisting><link linkend="ClutterPath">ClutterPath</link> * clutter_behaviour_path_get_path (<link linkend="ClutterBehaviourPath">ClutterBehaviourPath</link> *pathb);</programlisting>
243
Get the current path of the behaviour</para>
245
</para><variablelist role="params">
246
<varlistentry><term><parameter>pathb</parameter> :</term>
247
<listitem><simpara> a <link linkend="ClutterBehaviourPath"><type>ClutterBehaviourPath</type></link> instance
248
</simpara></listitem></varlistentry>
249
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the path. <acronym>transfer</acronym> none. </simpara></listitem></varlistentry>
250
</variablelist><para role="since">Since 1.0</para></refsect2>
251
<refsect2 id="ClutterKnot" role="struct" condition="since:0.2">
252
<title>ClutterKnot</title>
253
<indexterm zone="ClutterKnot" role="0.2"><primary sortas="Knot">ClutterKnot</primary></indexterm><programlisting>typedef struct {
259
Point in a path behaviour.</para>
261
</para><variablelist role="struct">
263
<term><link linkend="gint">gint</link> <structfield>x</structfield>;</term>
264
<listitem><simpara> X coordinate of the knot
265
</simpara></listitem>
268
<term><link linkend="gint">gint</link> <structfield>y</structfield>;</term>
269
<listitem><simpara> Y coordinate of the knot
270
</simpara></listitem>
272
</variablelist><para role="since">Since 0.2</para></refsect2>
273
<refsect2 id="clutter-knot-copy" role="function" condition="since:0.2">
274
<title>clutter_knot_copy ()</title>
275
<indexterm zone="clutter-knot-copy" role="0.2"><primary sortas="knot_copy">clutter_knot_copy</primary></indexterm><programlisting><link linkend="ClutterKnot">ClutterKnot</link> * clutter_knot_copy (const <link linkend="ClutterKnot">ClutterKnot</link> *knot);</programlisting>
277
Makes an allocated copy of a knot.</para>
279
</para><variablelist role="params">
280
<varlistentry><term><parameter>knot</parameter> :</term>
281
<listitem><simpara> a <link linkend="ClutterKnot"><type>ClutterKnot</type></link>
282
</simpara></listitem></varlistentry>
283
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the copied knot.
285
</simpara></listitem></varlistentry>
286
</variablelist><para role="since">Since 0.2</para></refsect2>
287
<refsect2 id="clutter-knot-free" role="function" condition="since:0.2">
288
<title>clutter_knot_free ()</title>
289
<indexterm zone="clutter-knot-free" role="0.2"><primary sortas="knot_free">clutter_knot_free</primary></indexterm><programlisting><link linkend="void">void</link> clutter_knot_free (<link linkend="ClutterKnot">ClutterKnot</link> *knot);</programlisting>
291
Frees the memory of an allocated knot.</para>
293
</para><variablelist role="params">
294
<varlistentry><term><parameter>knot</parameter> :</term>
295
<listitem><simpara> a <link linkend="ClutterKnot"><type>ClutterKnot</type></link>
296
</simpara></listitem></varlistentry>
297
</variablelist><para role="since">Since 0.2</para></refsect2>
298
<refsect2 id="clutter-knot-equal" role="function" condition="since:0.2">
299
<title>clutter_knot_equal ()</title>
300
<indexterm zone="clutter-knot-equal" role="0.2"><primary sortas="knot_equal">clutter_knot_equal</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> clutter_knot_equal (const <link linkend="ClutterKnot">ClutterKnot</link> *knot_a,
301
const <link linkend="ClutterKnot">ClutterKnot</link> *knot_b);</programlisting>
303
Compares to knot and checks if the point to the same location.</para>
305
</para><variablelist role="params">
306
<varlistentry><term><parameter>knot_a</parameter> :</term>
307
<listitem><simpara> First knot
308
</simpara></listitem></varlistentry>
309
<varlistentry><term><parameter>knot_b</parameter> :</term>
310
<listitem><simpara> Second knot
311
</simpara></listitem></varlistentry>
312
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the knots point to the same location.
314
</simpara></listitem></varlistentry>
315
</variablelist><para role="since">Since 0.2</para></refsect2>
318
<refsect1 id="ClutterBehaviourPath.property-details" role="property_details">
319
<title role="property_details.title">Property Details</title>
320
<refsect2 id="ClutterBehaviourPath--path" role="property"><title>The <literal>"path"</literal> property</title>
321
<indexterm zone="ClutterBehaviourPath--path"><primary sortas="BehaviourPath:path">ClutterBehaviourPath:path</primary></indexterm><programlisting> "path" <link linkend="ClutterPath">ClutterPath</link>* : Read / Write</programlisting>
322
<para>The ClutterPath object representing the path to animate along.</para></refsect2>
325
<refsect1 id="ClutterBehaviourPath.signal-details" role="signals">
326
<title role="signals.title">Signal Details</title>
327
<refsect2 id="ClutterBehaviourPath-knot-reached" role="signal"><title>The <literal>"knot-reached"</literal> signal</title>
328
<indexterm zone="ClutterBehaviourPath-knot-reached" role="0.2"><primary sortas="BehaviourPath::knot-reached">ClutterBehaviourPath::knot-reached</primary></indexterm><programlisting><link linkend="void">void</link> user_function (<link linkend="ClutterBehaviourPath">ClutterBehaviourPath</link> *pathb,
329
<link linkend="guint">guint</link> knot_num,
330
<link linkend="gpointer">gpointer</link> user_data) : Run Last</programlisting>
332
This signal is emitted each time a node defined inside the path
335
</para><variablelist role="params">
336
<varlistentry><term><parameter>pathb</parameter> :</term>
337
<listitem><simpara> the object which received the signal
338
</simpara></listitem></varlistentry>
339
<varlistentry><term><parameter>knot_num</parameter> :</term>
340
<listitem><simpara> the index of the <link linkend="ClutterPathKnot"><type>ClutterPathKnot</type></link> reached
341
</simpara></listitem></varlistentry>
342
<varlistentry><term><parameter>user_data</parameter> :</term>
343
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
344
</variablelist><para>Since 0.2</para></refsect2>