clutter-timeline

clutter-timeline — A class for time-based events

Functions

ClutterTimeline * clutter_timeline_clone ()
void clutter_timeline_set_loop ()
gboolean clutter_timeline_get_loop ()

Description

ClutterTimeline is a base class for managing time-based event that cause Clutter to redraw a stage, such as animations.

Each ClutterTimeline instance has a duration: once a timeline has been started, using clutter_timeline_start(), it will emit a signal that can be used to update the state of the actors.

It is important to note that ClutterTimeline is not a generic API for calling closures after an interval; each Timeline is tied into the master clock used to drive the frame cycle. If you need to schedule a closure after an interval, see clutter_threads_add_timeout() instead.

Users of ClutterTimeline should connect to the “new-frame” signal, which is emitted each time a timeline is advanced during the maste clock iteration. The “new-frame” signal provides the time elapsed since the beginning of the timeline, in milliseconds. A normalized progress value can be obtained by calling clutter_timeline_get_progress(). By using clutter_timeline_get_delta() it is possible to obtain the wallclock time elapsed since the last emission of the “new-frame” signal.

Initial state can be set up by using the “started” signal, while final state can be set up by using the “stopped” signal. The ClutterTimeline guarantees the emission of at least a single “new-frame” signal, as well as the emission of the “completed” signal every time the ClutterTimeline reaches its “duration”.

It is possible to connect to specific points in the timeline progress by adding markers using clutter_timeline_add_marker_at_time() and connecting to the “marker-reached” signal.

Timelines can be made to loop once they reach the end of their duration, by using clutter_timeline_set_repeat_count(); a looping timeline will still emit the “completed” signal once it reaches the end of its duration at each repeat. If you want to be notified of the end of the last repeat, use the “stopped” signal.

Timelines have a “direction”: the default direction is CLUTTER_TIMELINE_FORWARD, and goes from 0 to the duration; it is possible to change the direction to CLUTTER_TIMELINE_BACKWARD, and have the timeline go from the duration to 0. The direction can be automatically reversed when reaching completion by using the “auto-reverse” property.

Timelines are used in the Clutter animation framework by classes like ClutterAnimation, ClutterAnimator, and ClutterState.

Defining Timelines in ClutterScript

A ClutterTimeline can be described in ClutterScript like any other object. Additionally, it is possible to define markers directly inside the JSON definition by using the markers JSON object member, such as:

1
2
3
4
5
6
7
8
9
{
  "type" : "ClutterTimeline",
  "duration" : 1000,
  "markers" : [
    { "name" : "quarter", "time" : 250 },
    { "name" : "half-time", "time" : 500 },
    { "name" : "three-quarters", "time" : 750 }
  ]
}

Functions

clutter_timeline_clone ()

ClutterTimeline *
clutter_timeline_clone (ClutterTimeline *timeline);

clutter_timeline_clone has been deprecated since version 1.10 and should not be used in newly-written code.

Use clutter_timeline_new() or g_object_new() instead

Create a new ClutterTimeline instance which has property values matching that of supplied timeline. The cloned timeline will not be started and will not be positioned to the current position of the original timeline : you will have to start it with clutter_timeline_start().

The only cloned properties are:

  • “duration”

  • “loop”

  • “delay”

  • “direction”

Parameters

timeline

ClutterTimeline to duplicate.

 

Returns

a new ClutterTimeline, cloned from timeline .

[transfer full]

Since: 0.4


clutter_timeline_set_loop ()

void
clutter_timeline_set_loop (ClutterTimeline *timeline,
                           gboolean loop);

clutter_timeline_set_loop has been deprecated since version 1.10 and should not be used in newly-written code.

Use clutter_timeline_set_repeat_count() instead.

Sets whether timeline should loop.

This function is equivalent to calling clutter_timeline_set_repeat_count() with -1 if loop is TRUE, and with 0 if loop is FALSE.

Parameters

timeline

a ClutterTimeline

 

loop

TRUE for enable looping

 

clutter_timeline_get_loop ()

gboolean
clutter_timeline_get_loop (ClutterTimeline *timeline);

clutter_timeline_get_loop has been deprecated since version 1.10 and should not be used in newly-written code.

Use clutter_timeline_get_repeat_count() instead.

Gets whether timeline is looping

Parameters

timeline

a ClutterTimeline

 

Returns

TRUE if the timeline is looping

See Also

ClutterAnimation, ClutterAnimator, ClutterState