ClutterKeyframeTransition

ClutterKeyframeTransition — Keyframe property transition

Object Hierarchy

    GObject
    ╰── ClutterTimeline
        ╰── ClutterTransition
            ╰── ClutterPropertyTransition
                ╰── ClutterKeyframeTransition

Implemented Interfaces

ClutterKeyframeTransition implements ClutterScriptable.

Description

ClutterKeyframeTransition allows animating a property by defining "key frames": values at a normalized position on the transition duration.

The ClutterKeyframeTransition interpolates the value of the property to which it's bound across these key values.

Setting up a ClutterKeyframeTransition means providing the times, values, and easing modes between these key frames, for instance:

1
2
3
4
5
6
7
8
9
ClutterTransition *keyframe;

keyframe = clutter_keyframe_transition_new ("opacity");
clutter_transition_set_from (keyframe, G_TYPE_UINT, 255);
clutter_transition_set_to (keyframe, G_TYPE_UINT, 0);
clutter_keyframe_transition_set (CLUTTER_KEYFRAME_TRANSITION (keyframe),
                                 G_TYPE_UINT,
                                 1, /* number of key frames */
                                 0.5, 128, CLUTTER_EASE_IN_OUT_CUBIC);

The example above sets up a keyframe transition for the “opacity” property of a ClutterActor; the transition starts and sets the value of the property to fully transparent; between the start of the transition and its mid point, it will animate the property to half opacity, using an easy in/easy out progress. Once the transition reaches the mid point, it will linearly fade the actor out until it reaches the end of the transition.

The ClutterKeyframeTransition will add an implicit key frame between the last and the 1.0 value, to interpolate to the final value of the transition's interval.

ClutterKeyframeTransition is available since Clutter 1.12.

Functions

clutter_keyframe_transition_new ()

ClutterTransition *
clutter_keyframe_transition_new (const char *property_name);

Creates a new ClutterKeyframeTransition for property_name .

Parameters

property_name

the property to animate

 

Returns

the newly allocated ClutterKeyframeTransition instance. Use g_object_unref() when done to free its resources.

[transfer full]

Since: 1.12


clutter_keyframe_transition_set ()

void
clutter_keyframe_transition_set (ClutterKeyframeTransition *transition,
                                 GType gtype,
                                 guint n_key_frames,
                                 ...);

Sets the key frames of the transition .

This variadic arguments function is a convenience for C developers; language bindings should use clutter_keyframe_transition_set_key_frames(), clutter_keyframe_transition_set_modes(), and clutter_keyframe_transition_set_values() instead.

[skip]

Parameters

transition

a ClutterKeyframeTransition

 

gtype

the type of the values to use for the key frames

 

n_key_frames

the number of key frames between the initial and final values

 

...

a list of tuples, containing the key frame index, the value at the key frame, and the animation mode

 

Since: 1.12


clutter_keyframe_transition_set_key_frames ()

void
clutter_keyframe_transition_set_key_frames
                               (ClutterKeyframeTransition *transition,
                                guint n_key_frames,
                                const double *key_frames);

Sets the keys for each key frame inside transition .

If transition does not hold any key frame, n_key_frames key frames will be created; if transition already has key frames, key_frames must have at least as many elements as the number of key frames.

Parameters

transition

a ClutterKeyframeTransition

 

n_key_frames

the number of values

 

key_frames

an array of keys between 0.0 and 1.0, one for each key frame.

[array length=n_key_frames]

Since: 1.12


clutter_keyframe_transition_set_modes ()

void
clutter_keyframe_transition_set_modes (ClutterKeyframeTransition *transition,
                                       guint n_modes,
                                       const ClutterAnimationMode *modes);

Sets the easing modes for each key frame inside transition .

If transition does not hold any key frame, n_modes key frames will be created; if transition already has key frames, modes must have at least as many elements as the number of key frames.

Parameters

transition

a ClutterKeyframeTransition

 

n_modes

the number of easing modes

 

modes

an array of easing modes, one for each key frame.

[array length=n_modes]

Since: 1.12


clutter_keyframe_transition_set_values ()

void
clutter_keyframe_transition_set_values
                               (ClutterKeyframeTransition *transition,
                                guint n_values,
                                const GValue *values);

Sets the values for each key frame inside transition .

If transition does not hold any key frame, n_values key frames will be created; if transition already has key frames, values must have at least as many elements as the number of key frames.

Parameters

transition

a ClutterKeyframeTransition

 

n_values

the number of values

 

values

an array of values, one for each key frame.

[array length=n_values]

Since: 1.12


clutter_keyframe_transition_get_n_key_frames ()

guint
clutter_keyframe_transition_get_n_key_frames
                               (ClutterKeyframeTransition *transition);

Retrieves the number of key frames inside transition .

Parameters

transition

a ClutterKeyframeTransition

 

Returns

the number of key frames

Since: 1.12


clutter_keyframe_transition_set_key_frame ()

void
clutter_keyframe_transition_set_key_frame
                               (ClutterKeyframeTransition *transition,
                                guint index_,
                                double key,
                                ClutterAnimationMode mode,
                                const GValue *value);

Sets the details of the key frame at index_ inside transition .

The transition must already have a key frame at index_ , and index_ must be smaller than the number of key frames inside transition .

Parameters

transition

a ClutterKeyframeTransition

 

index_

the index of the key frame

 

key

the key of the key frame

 

mode

the easing mode of the key frame

 

value

a GValue containing the value of the key frame

 

Since: 1.12


clutter_keyframe_transition_get_key_frame ()

void
clutter_keyframe_transition_get_key_frame
                               (ClutterKeyframeTransition *transition,
                                guint index_,
                                double *key,
                                ClutterAnimationMode *mode,
                                GValue *value);

Retrieves the details of the key frame at index_ inside transition .

The transition must already have key frames set, and index_ must be smaller than the number of key frames.

Parameters

transition

a ClutterKeyframeTransition

 

index_

the index of the key frame

 

key

return location for the key, or NULL.

[out][allow-none]

mode

return location for the easing mode, or NULL.

[out][allow-none]

value

a GValue initialized with the type of the values.

[out caller-allocates]

Since: 1.12


clutter_keyframe_transition_clear ()

void
clutter_keyframe_transition_clear (ClutterKeyframeTransition *transition);

Removes all key frames from transition .

Parameters

transition

a ClutterKeyframeTransition

 

Since: 1.12

Types and Values

ClutterKeyframeTransition

typedef struct _ClutterKeyframeTransition ClutterKeyframeTransition;

The ClutterKeyframeTransition structure contains only private data and should be accessed using the provided API.

Since: 1.12


struct ClutterKeyframeTransitionClass

struct ClutterKeyframeTransitionClass {
};

The ClutterKeyframeTransitionClass structure contains only private data.

Since: 1.12