### Class

# Clutter Timeline

#### Description [src]

    class Clutter.Timeline : GObject.Object
    {
      /* No available fields */
    }

A class for time-based events

`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 a frame 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 `ClutterTimeline::new-frame` signal, which is emitted each time a timeline is advanced during the maste clock iteration. The `ClutterTimeline::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 `ClutterTimeline::new-frame` signal.

Initial state can be set up by using the `ClutterTimeline::started` signal, while final state can be set up by using the `ClutterTimeline::stopped` signal. The `ClutterTimeline` guarantees the emission of at least a single `ClutterTimeline::new-frame` signal, as well as the emission of the `ClutterTimeline::completed` signal every time the `ClutterTimeline` reaches its `ClutterTimeline: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 `ClutterTimeline::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 `ClutterTimeline::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 `ClutterTimeline::stopped` signal.

Timelines have a `ClutterTimeline: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 `ClutterTimeline:auto-reverse` property.

Timelines are used in the Clutter animation framework by classes like `ClutterTransition`.

#### Ancestors

- GObject

#### Descendants

- ClutterTransition

#### Constructors

###### clutter_timeline_new_for_actor

Creates a new `ClutterTimeline` with a duration of `duration` milli seconds.

###### clutter_timeline_new_for_frame_clock

Creates a new `ClutterTimeline` with a duration of `duration_ms` milli seconds.

#### Instance methods

###### clutter_timeline_add_marker

Adds a named marker that will be hit when the timeline has reached the specified `progress`.

###### clutter_timeline_add_marker_at_time

Adds a named marker that will be hit when the timeline has been running for `msecs` milliseconds.

###### clutter_timeline_advance

Advance timeline to the requested point. The point is given as a time in milliseconds since the timeline started.

###### clutter_timeline_advance_to_marker

Advances `timeline` to the time of the given `marker_name`.

###### clutter_timeline_get_actor

Get the actor the timeline is associated with.

###### clutter_timeline_get_auto_reverse

Retrieves the value set by `clutter_timeline_set_auto_reverse()`.

###### clutter_timeline_get_cubic_bezier_progress

Retrieves the control points for the cubic bezier progress mode.

###### clutter_timeline_get_current_repeat

Retrieves the current repeat for a timeline.

###### clutter_timeline_get_delay

Retrieves the delay set using `clutter_timeline_set_delay()`.

###### clutter_timeline_get_delta

Retrieves the amount of time elapsed since the last `ClutterTimeline::new-frame` signal.

###### clutter_timeline_get_direction

Retrieves the direction of the timeline set with `clutter_timeline_set_direction()`.

###### clutter_timeline_get_duration

Retrieves the duration of a `ClutterTimeline` in milliseconds. See `clutter_timeline_set_duration()`.

###### clutter_timeline_get_duration_hint

Retrieves the full duration of the `timeline`, taking into account the current value of the `ClutterTimeline:repeat-count` property.

###### clutter_timeline_get_elapsed_time

Request the current time position of the timeline.

###### clutter_timeline_get_frame_clock

No description available.

###### clutter_timeline_get_progress

The position of the timeline in a normalized [-1, 2] interval.

###### clutter_timeline_get_progress_mode

Retrieves the progress mode set using `clutter_timeline_set_progress_mode()` or `clutter_timeline_set_progress_func()`.

###### clutter_timeline_get_repeat_count

Retrieves the number set using `clutter_timeline_set_repeat_count()`.

###### clutter_timeline_get_step_progress

Retrieves the parameters of the step progress mode used by `timeline`.

###### clutter_timeline_has_marker

Checks whether `timeline` has a marker set with the given name.

###### clutter_timeline_is_playing

Queries state of a `ClutterTimeline`.

###### clutter_timeline_list_markers

Retrieves the list of markers at time `msecs`. If `msecs` is a negative integer, all the markers attached to `timeline` will be returned.

###### clutter_timeline_pause

Pauses the `ClutterTimeline` on current frame.

###### clutter_timeline_remove_marker

Removes `marker_name`, if found, from `timeline`.

###### clutter_timeline_rewind

Rewinds `ClutterTimeline` to the first frame if its direction is `CLUTTER_TIMELINE_FORWARD` and the last frame if it is `CLUTTER_TIMELINE_BACKWARD`.

###### clutter_timeline_set_actor

Set the actor the timeline is associated with.

###### clutter_timeline_set_auto_reverse

Sets whether `timeline` should reverse the direction after the emission of the `ClutterTimeline::completed` signal.

###### clutter_timeline_set_cubic_bezier_progress

Sets the `ClutterTimeline:progress-mode` of `timeline` to `CLUTTER_CUBIC_BEZIER`, and sets the two control points for the cubic bezier.

###### clutter_timeline_set_delay

Sets the delay, in milliseconds, before `timeline` should start.

###### clutter_timeline_set_direction

Sets the direction of `timeline`, either `CLUTTER_TIMELINE_FORWARD` or `CLUTTER_TIMELINE_BACKWARD`.

###### clutter_timeline_set_duration

Sets the duration of the timeline, in milliseconds. The speed of the timeline depends on the `ClutterTimeline:frame-clock` setting.

###### clutter_timeline_set_frame_clock

No description available.

###### clutter_timeline_set_progress_func

Sets a custom progress function for `timeline`. The progress function will be called by `clutter_timeline_get_progress()` and will be used to compute the progress value based on the elapsed time and the total duration of the timeline.

###### clutter_timeline_set_progress_mode

Sets the progress function using a value from the `ClutterAnimationMode` enumeration. The `mode` cannot be `CLUTTER_CUSTOM_MODE` or bigger than `CLUTTER_ANIMATION_LAST`.

###### clutter_timeline_set_repeat_count

Sets the number of times the `timeline` should repeat.

###### clutter_timeline_set_step_progress

Sets the `ClutterTimeline:progress-mode` of the `timeline` to `CLUTTER_STEPS` and provides the parameters of the step function.

###### clutter_timeline_skip

Advance timeline by the requested time in milliseconds.

###### clutter_timeline_start

Starts the `ClutterTimeline` playing.

###### clutter_timeline_stop

Stops the `ClutterTimeline` and moves to frame 0.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Clutter.Timeline:actor

No description available.

###### Clutter.Timeline:auto-reverse

If the direction of the timeline should be automatically reversed when reaching the end.

###### Clutter.Timeline:delay

A delay, in milliseconds, that should be observed by the timeline before actually starting.

###### Clutter.Timeline:direction

The direction of the timeline, either `CLUTTER_TIMELINE_FORWARD` or `CLUTTER_TIMELINE_BACKWARD`.

###### Clutter.Timeline:duration

Duration of the timeline in milliseconds, depending on the `ClutterTimeline:frame-clock` value.

###### Clutter.Timeline:frame-clock

The frame clock driving the timeline.

###### Clutter.Timeline:progress-mode

Controls the way a `ClutterTimeline` computes the normalized progress.

###### Clutter.Timeline:repeat-count

Defines how many times the timeline should repeat.

#### Signals

###### Clutter.Timeline::completed

The signal is emitted when the timeline’s elapsed time reaches the value of the `ClutterTimeline:duration` property.

###### Clutter.Timeline::marker-reached

The signal is emitted each time a timeline reaches a marker set with `clutter_timeline_add_marker_at_time()`.

###### Clutter.Timeline::new-frame

The signal is emitted for each timeline running timeline before a new frame is drawn to give animations a chance to update the scene.

###### Clutter.Timeline::paused

The signal is emitted when `clutter_timeline_pause()` is invoked.

###### Clutter.Timeline::started

The signal is emitted when the timeline starts its run. This might be as soon as `clutter_timeline_start()` is invoked or after the delay set in the `ClutterTimeline:delay` property has expired.

###### Clutter.Timeline::stopped

The signal is emitted when the timeline has been stopped, either because `clutter_timeline_stop()` has been called, or because it has been exhausted.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct ClutterTimelineClass {
      void (* started) (
        ClutterTimeline* timeline
      );
      void (* completed) (
        ClutterTimeline* timeline
      );
      void (* paused) (
        ClutterTimeline* timeline
      );
      void (* new_frame) (
        ClutterTimeline* timeline,
        gint msecs
      );
      void (* marker_reached) (
        ClutterTimeline* timeline,
        const gchar* marker_name,
        gint msecs
      );
      void (* stopped) (
        ClutterTimeline* timeline,
        gboolean is_finished
      );

    }

The `ClutterTimelineClass` structure contains only private data.

###### Class members

`started: void (* started) ( ClutterTimeline* timeline )`

  Class handler for the `ClutterTimeline::started` signal.

`completed: void (* completed) ( ClutterTimeline* timeline )`

  Class handler for the `ClutterTimeline::completed` signal.

`paused: void (* paused) ( ClutterTimeline* timeline )`

  Class handler for the `ClutterTimeline::paused` signal.

`new_frame: void (* new_frame) ( ClutterTimeline* timeline, gint msecs )`

  Class handler for the `ClutterTimeline::new-frame` signal.

`marker_reached: void (* marker_reached) ( ClutterTimeline* timeline, const gchar* marker_name, gint msecs )`

  Class handler for the `ClutterTimeline::marker-reached` signal.

`stopped: void (* stopped) ( ClutterTimeline* timeline, gboolean is_finished )`

  Class handler for the `ClutterTimeline::stopped` signal.

#### Virtual methods

###### Clutter.TimelineClass.completed

Class handler for the `ClutterTimeline::completed` signal.

###### Clutter.TimelineClass.marker_reached

Class handler for the `ClutterTimeline::marker-reached` signal.

###### Clutter.TimelineClass.new_frame

Class handler for the `ClutterTimeline::new-frame` signal.

###### Clutter.TimelineClass.paused

Class handler for the `ClutterTimeline::paused` signal.

###### Clutter.TimelineClass.started

Class handler for the `ClutterTimeline::started` signal.

###### Clutter.TimelineClass.stopped

Class handler for the `ClutterTimeline::stopped` signal.