ClutterTimeline

ClutterTimeline — A class for based events

Synopsis




                    ClutterTimeline;
                    ClutterTimelineClass;
ClutterTimeline*    clutter_timeline_new                (guint n_frames,
                                                         guint fps);
ClutterTimeline*    clutter_timeline_clone              (ClutterTimeline *timeline);
void                clutter_timeline_set_speed          (ClutterTimeline *timeline,
                                                         guint fps);
guint               clutter_timeline_get_speed          (ClutterTimeline *timeline);
void                clutter_timeline_start              (ClutterTimeline *timeline);
void                clutter_timeline_pause              (ClutterTimeline *timeline);
void                clutter_timeline_stop               (ClutterTimeline *timeline);
void                clutter_timeline_set_loop           (ClutterTimeline *timeline,
                                                         gboolean loop);
gboolean            clutter_timeline_get_loop           (ClutterTimeline *timeline);
void                clutter_timeline_rewind             (ClutterTimeline *timeline);
void                clutter_timeline_skip               (ClutterTimeline *timeline,
                                                         guint n_frames);
void                clutter_timeline_advance            (ClutterTimeline *timeline,
                                                         guint frame_num);
gint                clutter_timeline_get_current_frame  (ClutterTimeline *timeline);
void                clutter_timeline_set_n_frames       (ClutterTimeline *timeline,
                                                         guint n_frames);
guint               clutter_timeline_get_n_frames       (ClutterTimeline *timeline);
gboolean            clutter_timeline_is_playing         (ClutterTimeline *timeline);
void                clutter_timeline_set_delay          (ClutterTimeline *timeline,
                                                         guint msecs);
guint               clutter_timeline_get_delay          (ClutterTimeline *timeline);


Object Hierarchy


  GObject
   +----ClutterTimeline

Properties


  "delay"                    guint                 : Read / Write / Construct
  "fps"                      guint                 : Read / Write / Construct
  "loop"                     gboolean              : Read / Write / Construct
  "num-frames"               guint                 : Read / Write / Construct

Signals


  "completed"                                      : Run Last
  "new-frame"                                      : Run Last
  "paused"                                         : Run Last
  "started"                                        : Run Last

Description

ClutterTimeline is a base class for managing time based events such as animations.

Note: Every timeline shares the same ClutterTimeoutPool to decrease the possibility of starvating the main loop when using many timelines at the same time; this might cause problems if you are also using a library making heavy use of threads with no GLib main loop integration. In that case you might disable the common timeline pool by setting the CLUTTER_TIMELINE=no-pool environment variable prior to launching your application.

Details

ClutterTimeline

typedef struct _ClutterTimeline ClutterTimeline;


ClutterTimelineClass

typedef struct {
  void (*started)   (ClutterTimeline *timeline);
  void (*completed) (ClutterTimeline *timeline);
  void (*paused)    (ClutterTimeline *timeline);
  
  void (*new_frame) (ClutterTimeline *timeline,
		     gint             frame_num);
} ClutterTimelineClass;


clutter_timeline_new ()

ClutterTimeline*    clutter_timeline_new                (guint n_frames,
                                                         guint fps);

Create a new ClutterTimeline instance.

n_frames : the number of frames
fps : the number of frames per second
Returns : a new ClutterTimeline

clutter_timeline_clone ()

ClutterTimeline*    clutter_timeline_clone              (ClutterTimeline *timeline);

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 timeline: you will have to start it with clutter_timeline_start().

timeline : ClutterTimeline to duplicate.
Returns : a new ClutterTimeline, cloned from timeline Since 0.4

clutter_timeline_set_speed ()

void                clutter_timeline_set_speed          (ClutterTimeline *timeline,
                                                         guint fps);

Set the speed in frames per second of the timeline.

timeline : A ClutterTimeline
fps : New speed of timeline as frames per second

clutter_timeline_get_speed ()

guint               clutter_timeline_get_speed          (ClutterTimeline *timeline);

Gets the frames per second played by timeline

timeline : a ClutterTimeline
Returns : the number of frames per second.

clutter_timeline_start ()

void                clutter_timeline_start              (ClutterTimeline *timeline);

Starts the ClutterTimeline playing.

timeline : A ClutterTimeline

clutter_timeline_pause ()

void                clutter_timeline_pause              (ClutterTimeline *timeline);

Pauses the ClutterTimeline on current frame

timeline : A ClutterTimeline

clutter_timeline_stop ()

void                clutter_timeline_stop               (ClutterTimeline *timeline);

Stops the ClutterTimeline and moves to frame 0

timeline : A ClutterTimeline

clutter_timeline_set_loop ()

void                clutter_timeline_set_loop           (ClutterTimeline *timeline,
                                                         gboolean loop);

Sets whether timeline should loop.

timeline : a ClutterTimeline
loop : TRUE for enable looping

clutter_timeline_get_loop ()

gboolean            clutter_timeline_get_loop           (ClutterTimeline *timeline);

Gets whether timeline is looping

timeline : a ClutterTimeline
Returns : TRUE if the timeline is looping

clutter_timeline_rewind ()

void                clutter_timeline_rewind             (ClutterTimeline *timeline);

Rewinds ClutterTimeline to frame 0.

timeline : A ClutterTimeline

clutter_timeline_skip ()

void                clutter_timeline_skip               (ClutterTimeline *timeline,
                                                         guint n_frames);

Advance timeline by requested number of frames.

timeline : A ClutterTimeline
n_frames : Number of frames to skip

clutter_timeline_advance ()

void                clutter_timeline_advance            (ClutterTimeline *timeline,
                                                         guint frame_num);

Advance timeline to requested frame number

timeline : A ClutterTimeline
frame_num : Frame number to advance to

clutter_timeline_get_current_frame ()

gint                clutter_timeline_get_current_frame  (ClutterTimeline *timeline);

Request the current frame number of the timeline.

timeline : A ClutterTimeline
Returns : current frame number

clutter_timeline_set_n_frames ()

void                clutter_timeline_set_n_frames       (ClutterTimeline *timeline,
                                                         guint n_frames);

Sets the total number of frames for timeline

timeline : a ClutterTimeline
n_frames : the number of frames

clutter_timeline_get_n_frames ()

guint               clutter_timeline_get_n_frames       (ClutterTimeline *timeline);

Request the total number of frames for the ClutterTimeline.

timeline : A ClutterTimeline
Returns : Number of frames for this ClutterTimeline.

clutter_timeline_is_playing ()

gboolean            clutter_timeline_is_playing         (ClutterTimeline *timeline);

Query state of a ClutterTimeline instance.

timeline : A ClutterTimeline
Returns : TRUE if timeline is currently playing, FALSE if not.

clutter_timeline_set_delay ()

void                clutter_timeline_set_delay          (ClutterTimeline *timeline,
                                                         guint msecs);

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

timeline : a ClutterTimeline
msecs : delay in milliseconds

Since 0.4


clutter_timeline_get_delay ()

guint               clutter_timeline_get_delay          (ClutterTimeline *timeline);

Retrieves the delay set using clutter_timeline_set_delay().

timeline : a ClutterTimeline
Returns : the delay in milliseconds.

Since 0.4

Property Details

The "delay" property

  "delay"                    guint                 : Read / Write / Construct

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

Default value: 0

Since 0.4


The "fps" property

  "fps"                      guint                 : Read / Write / Construct

Timeline frames per second. Because of the nature of the main loop used by Clutter this is to be considered a best approximation.

Allowed values: [1,1000]

Default value: 50


The "loop" property

  "loop"                     gboolean              : Read / Write / Construct

Whether the timeline should automatically rewind and restart.

Default value: FALSE


The "num-frames" property

  "num-frames"               guint                 : Read / Write / Construct

Total number of frames for the timeline.

Allowed values: >= 1

Default value: 1

Signal Details

The "completed" signal

void                user_function                      (ClutterTimeline *timeline,
                                                        gpointer         user_data)      : Run Last

The ::completed signal is emitted when the timeline reaches the number of frames specified by the ClutterTimeline:num-frames property.

timeline : the ClutterTimeline which received the signal
user_data : user data set when the signal handler was connected.

The "new-frame" signal

void                user_function                      (ClutterTimeline *timeline,
                                                        gint             frame_num,
                                                        gpointer         user_data)      : Run Last

The ::new-frame signal is emitted each time a new frame in the timeline is reached.

timeline : the timeline which received the signal
frame_num : the number of the new frame
user_data : user data set when the signal handler was connected.

The "paused" signal

void                user_function                      (ClutterTimeline *timeline,
                                                        gpointer         user_data)      : Run Last

The ::paused signal is emitted when clutter_timeline_pause() is invoked.

timeline : the ClutterTimeline which received the signal
user_data : user data set when the signal handler was connected.

The "started" signal

void                user_function                      (ClutterTimeline *timeline,
                                                        gpointer         user_data)      : Run Last

The ::started 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.

timeline : the ClutterTimeline which received the signal
user_data : user data set when the signal handler was connected.