Class
ClutterTimeline
since: 13
Description [src]
class Clutter.Timeline : GObject.Object
implements Clutter.Scriptable {
/* 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
.
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:
{
"type" : "ClutterTimeline",
"duration" : 1000,
"markers" : [
{ "name" : "quarter", "time" : 250 },
{ "name" : "half-time", "time" : 500 },
{ "name" : "three-quarters", "time" : 750 }
]
}
Available since: 13
Constructors
clutter_timeline_new
Creates a new ClutterTimeline
with a duration of duration_ms
milli seconds.
since: 13
clutter_timeline_new_for_actor
Creates a new ClutterTimeline
with a duration of duration
milli seconds.
since: 13
clutter_timeline_new_for_frame_clock
Creates a new ClutterTimeline
with a duration of duration_ms
milli seconds.
since: 13
Instance methods
clutter_timeline_add_marker
Adds a named marker that will be hit when the timeline has reached
the specified progress
.
since: 13
clutter_timeline_add_marker_at_time
Adds a named marker that will be hit when the timeline has been
running for msecs
milliseconds.
since: 13
clutter_timeline_advance
Advance timeline to the requested point. The point is given as a time in milliseconds since the timeline started.
since: 13
clutter_timeline_advance_to_marker
Advances timeline
to the time of the given marker_name
.
since: 13
clutter_timeline_get_auto_reverse
Retrieves the value set by clutter_timeline_set_auto_reverse()
.
since: 13
clutter_timeline_get_cubic_bezier_progress
Retrieves the control points for the cubic bezier progress mode.
since: 13
clutter_timeline_get_delta
Retrieves the amount of time elapsed since the last
ClutterTimeline::new-frame
signal.
since: 13
clutter_timeline_get_direction
Retrieves the direction of the timeline set with
clutter_timeline_set_direction()
.
since: 13
clutter_timeline_get_duration
Retrieves the duration of a ClutterTimeline
in milliseconds.
See clutter_timeline_set_duration()
.
since: 13
clutter_timeline_get_duration_hint
Retrieves the full duration of the timeline
, taking into account the
current value of the ClutterTimeline:repeat-count
property.
since: 13
clutter_timeline_get_progress
The position of the timeline in a normalized [-1, 2] interval.
since: 13
clutter_timeline_get_progress_mode
Retrieves the progress mode set using clutter_timeline_set_progress_mode()
or clutter_timeline_set_progress_func()
.
since: 13
clutter_timeline_get_repeat_count
Retrieves the number set using clutter_timeline_set_repeat_count()
.
since: 13
clutter_timeline_get_step_progress
Retrieves the parameters of the step progress mode used by timeline
.
since: 13
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.
since: 13
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
.
since: 13
clutter_timeline_set_auto_reverse
Sets whether timeline
should reverse the direction after the
emission of the ClutterTimeline::completed
signal.
since: 13
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.
since: 13
clutter_timeline_set_direction
Sets the direction of timeline
, either CLUTTER_TIMELINE_FORWARD
or
CLUTTER_TIMELINE_BACKWARD
.
since: 13
clutter_timeline_set_duration
Sets the duration of the timeline, in milliseconds. The speed
of the timeline depends on the ClutterTimeline:frame-clock
setting.
since: 13
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.
since: 13
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
.
since: 13
clutter_timeline_set_step_progress
Sets the ClutterTimeline:progress-mode
of the timeline
to CLUTTER_STEPS
and provides the parameters of the step function.
since: 13
Methods inherited from ClutterScriptable (4)
clutter_scriptable_get_id
Retrieves the id of scriptable
set using clutter_scriptable_set_id()
.
since: 13
clutter_scriptable_parse_custom_node
Parses the passed JSON node. The implementation must set the type
of the passed GValue
pointer using g_value_init().
since: 13
clutter_scriptable_set_custom_property
Overrides the common properties setting. The underlying virtual function should be used when implementing custom properties.
since: 13
clutter_scriptable_set_id
Sets id_
as the unique Clutter script it for this instance of
ClutterScriptableIface
.
since: 13
Properties
Clutter.Timeline:auto-reverse
If the direction of the timeline should be automatically reversed when reaching the end.
since: 13
Clutter.Timeline:delay
A delay, in milliseconds, that should be observed by the timeline before actually starting.
since: 13
Clutter.Timeline:direction
The direction of the timeline, either CLUTTER_TIMELINE_FORWARD
or
CLUTTER_TIMELINE_BACKWARD
.
since: 13
Clutter.Timeline:duration
Duration of the timeline in milliseconds, depending on the
ClutterTimeline:frame-clock
value.
since: 13
Clutter.Timeline:progress-mode
Controls the way a ClutterTimeline
computes the normalized progress.
since: 13
Signals
Clutter.Timeline::completed
The signal is emitted when the timeline’s
elapsed time reaches the value of the ClutterTimeline:duration
property.
since: 13
Clutter.Timeline::marker-reached
The signal is emitted each time a timeline
reaches a marker set with clutter_timeline_add_marker_at_time()
.
since: 13
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.
since: 13
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.
since: 13
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.
since: 13
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.
since: 2.0
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 )
- No description available.
completed: void (* completed) ( ClutterTimeline* timeline )
- No description available.
paused: void (* paused) ( ClutterTimeline* timeline )
- No description available.
new_frame: void (* new_frame) ( ClutterTimeline* timeline, gint msecs )
- No description available.
marker_reached: void (* marker_reached) ( ClutterTimeline* timeline, const gchar* marker_name, gint msecs )
- No description available.
stopped: void (* stopped) ( ClutterTimeline* timeline, gboolean is_finished )
- No description available.