Top | ![]() |
![]() |
![]() |
![]() |
ClutterAnimator is an object providing declarative animations for GObject properties belonging to one or more GObjects to ClutterIntervals.
ClutterAnimator is used to build and describe complex animations in terms of "key frames". ClutterAnimator is meant to be used through the ClutterScript definition format, but it comes with a convenience C API.
ClutterAnimator is available since Clutter 1.2
ClutterAnimator has been deprecated in Clutter 1.12. If you want to combine multiple transitions using key frames, use ClutterKeyframeTransition and ClutterTransitionGroup instead.
Every animation handled by a ClutterAnimator can be described in terms of "key frames". For each GObject property there can be multiple key frames, each one defined by the end value for the property to be computed starting from the current value to a specific point in time, using a given easing mode.
The point in time is defined using a value representing
the progress in the normalized interval of [ 0, 1 ]. This maps
the value returned by clutter_timeline_get_duration()
.
ClutterAnimator defines a custom "properties" key which allows describing the key frames for objects as an array of key frames.
The properties
array has the following syntax:
1 2 3 4 5 6 7 8 9 10 11 12 |
{ "properties" : [ { "object" : object_id "name" : property_name "ease-in" : true_or_false "interpolation" : interpolation_value "keys" : [ [ progress, easing_mode, final_value ] ] ] } |
The following JSON fragment defines a ClutterAnimator with the duration of 1 second and operating on the x and y properties of a ClutterActor named "rect-01", with two frames for each property. The first frame will linearly move the actor from its current position to the 100, 100 position in 20 percent of the duration of the animation; the second will using a cubic easing to move the actor to the 200, 200 coordinates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
{ "type" : "ClutterAnimator", "duration" : 1000, "properties" : [ { "object" : "rect-01", "name" : "x", "ease-in" : true, "keys" : [ [ 0.2, "linear", 100.0 ], [ 1.0, "easeOutCubic", 200.0 ] ] }, { "object" : "rect-01", "name" : "y", "ease-in" : true, "keys" : [ [ 0.2, "linear", 100.0 ], [ 1.0, "easeOutCubic", 200.0 ] ] } ] } |
ClutterAnimator *
clutter_animator_new (void
);
clutter_animator_new
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Creates a new ClutterAnimator instance
Since: 1.2
void clutter_animator_set (ClutterAnimator *animator
,gpointer first_object
,const gchar *first_property_name
,guint first_mode
,gdouble first_progress
,...
);
clutter_animator_set
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Adds multiple keys to a ClutterAnimator, specifying the value a given
property should have at a given progress of the animation. The mode
specified is the mode used when going to this key from the previous key of
the property_name
If a given (object, property, progress) tuple already exist the mode and value will be replaced with the new values.
animator |
||
first_object |
a GObject |
|
first_property_name |
the property to specify a key for |
|
first_mode |
the id of the alpha function to use |
|
first_progress |
at which stage of the animation this value applies; the range is a normalized floating point value between 0 and 1 |
|
... |
the value first_property_name should have for first_object
at first_progress, followed by more (object, property_name, mode,
progress, value) tuples, followed by |
Since: 1.2
ClutterAnimator * clutter_animator_set_key (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
,guint mode
,gdouble progress
,const GValue *value
);
clutter_animator_set_key
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Sets a single key in the ClutterAnimator for the property_name
of
object
at progress
.
See also: clutter_animator_set()
animator |
||
object |
a GObject |
|
property_name |
the property to specify a key for |
|
mode |
the id of the alpha function to use |
|
progress |
the normalized range at which stage of the animation this value applies |
|
value |
the value property_name should have at progress. |
Since: 1.2
void clutter_animator_remove_key (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
,gdouble progress
);
clutter_animator_remove_key
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Removes all keys matching the conditions specificed in the arguments.
animator |
||
object |
[allow-none] | |
property_name |
a specific property name to query for,
or |
[allow-none] |
progress |
a specific progress to search for or a negative value for all |
Since: 1.2
GList * clutter_animator_get_keys (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
,gdouble progress
);
clutter_animator_get_keys
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Returns a list of pointers to opaque structures with accessor functions that describe the keys added to an animator.
animator |
a ClutterAnimator instance |
|
object |
[allow-none] | |
property_name |
a specific property name to query for,
or |
[allow-none] |
progress |
a specific progress to search for, or a negative value for all progresses |
a
list of ClutterAnimatorKeys; the contents of the list are owned
by the ClutterAnimator, but you should free the returned list when done,
using g_list_free()
.
[transfer container][element-type Clutter.AnimatorKey]
Since: 1.2
ClutterTimeline *
clutter_animator_start (ClutterAnimator *animator
);
clutter_animator_start
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Start the ClutterAnimator, this is a thin wrapper that rewinds and starts the animators current timeline.
the ClutterTimeline that drives the animator. The returned timeline is owned by the ClutterAnimator and it should not be unreferenced.
[transfer none]
Since: 1.2
gboolean clutter_animator_compute_value (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
,gdouble progress
,GValue *value
);
clutter_animator_compute_value
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Compute the value for a managed property at a given progress.
If the property is an ease-in property, the current value of the property on the object will be used as the starting point for computation.
animator |
||
object |
a GObject |
|
property_name |
the name of the property on object to check |
|
progress |
a value between 0.0 and 1.0 |
|
value |
an initialized value to store the computed result |
TRUE
if the computation yields has a value, otherwise (when
an error occurs or the progress is before any of the keys) FALSE
is
returned and the GValue is left untouched
Since: 1.2
void clutter_animator_set_timeline (ClutterAnimator *animator
,ClutterTimeline *timeline
);
clutter_animator_set_timeline
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Sets an external timeline that will be used for driving the animation
Since: 1.2
ClutterTimeline *
clutter_animator_get_timeline (ClutterAnimator *animator
);
clutter_animator_get_timeline
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Get the timeline hooked up for driving the ClutterAnimator
Since: 1.2
void clutter_animator_set_duration (ClutterAnimator *animator
,guint duration
);
clutter_animator_set_duration
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Runs the timeline of the ClutterAnimator with a duration in msecs as specified.
Since: 1.2
guint
clutter_animator_get_duration (ClutterAnimator *animator
);
clutter_animator_get_duration
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves the current duration of an animator
Since: 1.2
void clutter_animator_property_set_ease_in (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
,gboolean ease_in
);
clutter_animator_property_set_ease_in
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Sets whether a property value is to be eased into the animation.
animator |
||
object |
a GObject |
|
property_name |
the name of a property on object |
|
ease_in |
we are going to be easing in this property |
Since: 1.2
gboolean clutter_animator_property_get_ease_in (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
);
clutter_animator_property_get_ease_in
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Checks if a property value is to be eased into the animation.
Since: 1.2
void clutter_animator_property_set_interpolation (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
,ClutterInterpolation interpolation
);
clutter_animator_property_set_interpolation
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Set the interpolation method to use, CLUTTER_INTERPOLATION_LINEAR
causes
the values to linearly change between the values, and
CLUTTER_INTERPOLATION_CUBIC
causes the values to smoothly change between
the values.
animator |
||
object |
a GObject |
|
property_name |
the name of a property on object |
|
interpolation |
the ClutterInterpolation to use |
Since: 1.2
ClutterInterpolation clutter_animator_property_get_interpolation (ClutterAnimator *animator
,GObject *object
,const gchar *property_name
);
clutter_animator_property_get_interpolation
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Get the interpolation used by animator for a property on a particular object.
Since: 1.2
GObject *
clutter_animator_key_get_object (const ClutterAnimatorKey *key
);
clutter_animator_key_get_object
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves the object a key applies to.
Since: 1.2
const gchar *
clutter_animator_key_get_property_name
(const ClutterAnimatorKey *key
);
clutter_animator_key_get_property_name
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves the name of the property a key applies to.
Since: 1.2
GType
clutter_animator_key_get_property_type
(const ClutterAnimatorKey *key
);
clutter_animator_key_get_property_type
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves the GType of the property a key applies to
You can use this type to initialize the GValue to pass to
clutter_animator_key_get_value()
Since: 1.2
gulong
clutter_animator_key_get_mode (const ClutterAnimatorKey *key
);
clutter_animator_key_get_mode
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves the mode of a ClutterAnimator key, for the first key of a property for an object this represents the whether the animation is open ended and or curved for the remainding keys for the property it represents the easing mode.
Since: 1.2
gdouble
clutter_animator_key_get_progress (const ClutterAnimatorKey *key
);
clutter_animator_key_get_progress
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves the progress of an clutter_animator_key
Since: 1.2
gboolean clutter_animator_key_get_value (const ClutterAnimatorKey *key
,GValue *value
);
clutter_animator_key_get_value
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Retrieves a copy of the value for a ClutterAnimatorKey.
The passed in GValue needs to be already initialized for the value type of the key or to a type that allow transformation from the value type of the key.
Use g_value_unset()
when done.
Since: 1.2
typedef struct _ClutterAnimator ClutterAnimator;
ClutterAnimator
has been deprecated since version 1.12 and should not be used in newly-written code.
The ClutterAnimator structure contains only private data and should be accessed using the provided API
Since: 1.2
struct ClutterAnimatorClass { };
ClutterAnimatorClass
has been deprecated since version 1.12 and should not be used in newly-written code.
The ClutterAnimatorClass structure contains only private data
Since: 1.2
ClutterInterpolation
has been deprecated since version 1.22 and should not be used in newly-written code.
The mode of interpolation between key frames
Since: 1.2
typedef struct _ClutterAnimatorKey ClutterAnimatorKey;
ClutterAnimatorKey
has been deprecated since version 1.12 and should not be used in newly-written code.
A key frame inside a ClutterAnimator
Since: 1.2
“duration”
property“duration” guint
The duration of the ClutterTimeline used by the ClutterAnimator to drive the animation
ClutterAnimator:duration
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Owner: ClutterAnimator
Flags: Read / Write
Default value: 2000
Since: 1.2
“timeline”
property“timeline” ClutterTimeline *
The ClutterTimeline used by the ClutterAnimator to drive the animation
ClutterAnimator:timeline
has been deprecated since version 1.12 and should not be used in newly-written code.
Use ClutterKeyframeTransition instead
Owner: ClutterAnimator
Flags: Read / Write
Since: 1.2