Next: , Previous: ClutterRectangle, Up: Top


30 ClutterScore

Controller for multiple timelines

30.1 Overview

<clutter-score> is a base class for sequencing multiple timelines in order. Using <clutter-score> it is possible to start multiple timelines at the same time or launch multiple timelines when a particular timeline has emitted the ClutterTimeline::completed signal.

Each time a <clutter-timeline> is started and completed, a signal will be emitted.

For example, this code will start two <clutter-timeline>s after a third timeline terminates:

     
       ClutterTimeline *timeline_1, *timeline_2, *timeline_3;
       ClutterScore *score;
     
       timeline_1 = clutter_timeline_new_for_duration (1000);
       timeline_2 = clutter_timeline_new_for_duration (500);
       timeline_3 = clutter_timeline_new_for_duration (500);
     
       score = clutter_score_new ();
     
       clutter_score_append (score, NULL,       timeline_1);
       clutter_score_append (score, timeline_1, timeline_2);
       clutter_score_append (score, timeline_1, timeline_3);
     
       clutter_score_start ();

A <clutter-score> takes a reference on the timelines it manages, so timelines can be safely unreferenced after being appended.

New timelines can be appended to the <clutter-score> using clutter-score-append and removed using clutter-score-remove.

Timelines can also be appended to a specific marker on the parent timeline, using clutter-score-append-at-marker.

The score can be cleared using clutter-score-remove-all.

The list of timelines can be retrieved using clutter-score-list-timelines.

The score state is controlled using clutter-score-start, clutter-score-pause, clutter-score-stop and clutter-score-rewind. The state can be queried using clutter-score-is-playing.

<clutter-score> is available since Clutter 0.6

30.2 Usage

— Class: <clutter-score>

Derives from <gobject>.

This class defines the following slots:

loop
Whether the score should restart once finished
— Signal on <clutter-score>: completed

The ::completed signal is emitted each time a <clutter-score> terminates.

Since 0.6

— Signal on <clutter-score>: started

The ::started signal is emitted each time a <clutter-score> starts playing.

Since 0.6

— Signal on <clutter-score>: paused

The ::paused signal is emitted each time a <clutter-score> is paused.

Since 0.6

— Signal on <clutter-score>: timeline-started (arg0 <clutter-timeline>)

The ::timeline-started signal is emitted each time a new timeline inside a <clutter-score> starts playing.

Since 0.6

— Signal on <clutter-score>: timeline-completed (arg0 <clutter-timeline>)

The ::timeline-completed signal is emitted each time a timeline inside a <clutter-score> terminates.

Since 0.6

— Function: clutter-score-new   (ret <clutter-score>)

Creates a new <clutter-score>. A <clutter-score> is an object that can hold multiple <clutter-timeline>s in a sequential order.

ret
the newly created <clutter-score>. Use g-object-unref when done.

Since 0.6

— Function: clutter-score-set-loop (self <clutter-score>) (loop bool)
— Method: set-loop

Sets whether score should loop. A looping <clutter-score> will start from its initial state after the ::complete signal has been fired.

score
a <clutter-score>
loop
#t’ for enable looping

Since 0.6

— Function: clutter-score-get-loop (self <clutter-score>)   (ret bool)
— Method: get-loop

Gets whether score is looping

score
a <clutter-score>
ret
#t’ if the score is looping

Since 0.6

— Function: clutter-score-append (self <clutter-score>) (parent <clutter-timeline>) (timeline <clutter-timeline>)   (ret unsigned-long)
— Method: append

Appends a timeline to another one existing in the score; the newly appended timeline will be started when parent is complete.

If parent is ‘#f’, the new <clutter-timeline> will be started when clutter-score-start is called.

<clutter-score> will take a reference on timeline.

score
a <clutter-score>
parent
a <clutter-timeline> in the score, or ‘#f
timeline
a <clutter-timeline>
ret
the id of the <clutter-timeline> inside the score, or 0 on failure. The returned id can be used with clutter-score-remove or clutter-score-get-timeline.

Since 0.6

— Function: clutter-score-append-at-marker (self <clutter-score>) (parent <clutter-timeline>) (marker_name mchars) (timeline <clutter-timeline>)   (ret unsigned-long)
— Method: append-at-marker

Appends timeline at the given marker-name on the parent<clutter-timeline>.

If you want to append timeline at the end of parent, use clutter-score-append.

The <clutter-score> will take a reference on timeline.

score
a <clutter-score>
parent
the parent <clutter-timeline>
marker-name
the name of the marker to use
timeline
the <clutter-timeline> to append
ret
the id of the <clutter-timeline> inside the score, or 0 on failure. The returned id can be used with clutter-score-remove or clutter-score-get-timeline.

Since 0.8

— Function: clutter-score-remove (self <clutter-score>) (id unsigned-long)
— Method: remove

Removes the <clutter-timeline> with the given id inside score. If the timeline has other timelines attached to it, those are removed as well.

score
a <clutter-score>
id
the id of the timeline to remove

Since 0.6

— Function: clutter-score-remove-all (self <clutter-score>)
— Method: remove-all

Removes all the timelines inside score.

score
a <clutter-score>

Since 0.6

— Function: clutter-score-get-timeline (self <clutter-score>) (id unsigned-long)   (ret <clutter-timeline>)
— Method: get-timeline

Retrieves the <clutter-timeline> for id inside score.

score
a <clutter-score>
id
the id of the timeline
ret
the requested timeline, or ‘#f’. This function does not increase the reference count on the returned <clutter-timeline>

Since 0.6

— Function: clutter-score-list-timelines (self <clutter-score>)   (ret gslist-of)
— Method: list-timelines

Retrieves a list of all the <clutter-timelines> managed by score.

score
a <clutter-score>
ret
a <gs-list> containing all the timelines in the score. This function does not increase the reference count of the returned timelines. Use g-slist-free on the returned list to deallocate its resources.

Since 0.6

— Function: clutter-score-start (self <clutter-score>)
— Method: start

Starts the score.

score
A <clutter-score>

Since 0.6

— Function: clutter-score-pause (self <clutter-score>)
— Method: pause

Pauses a playing score score.

score
a <clutter-score>

Since 0.6

— Function: clutter-score-stop (self <clutter-score>)
— Method: stop

Stops and rewinds a playing <clutter-score> instance.

score
A <clutter-score>

Since 0.6

— Function: clutter-score-is-playing (self <clutter-score>)   (ret bool)
— Method: is-playing

Query state of a <clutter-score> instance.

score
A <clutter-score>
ret
#t’ if score is currently playing

Since 0.6

— Function: clutter-score-rewind (self <clutter-score>)
— Method: rewind

Rewinds a <clutter-score> to its initial state.

score
A <clutter-score>

Since 0.6