![]() |
![]() |
![]() |
Clutter Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
ClutterAlpha; ClutterAlphaClass; gdouble (*ClutterAlphaFunc) (ClutterAlpha *alpha, gpointer user_data); ClutterAlpha * clutter_alpha_new (void); ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline, gulong mode); ClutterAlpha * clutter_alpha_new_with_func (ClutterTimeline *timeline, ClutterAlphaFunc func, gpointer data, GDestroyNotify destroy); void clutter_alpha_set_timeline (ClutterAlpha *alpha, ClutterTimeline *timeline); ClutterTimeline * clutter_alpha_get_timeline (ClutterAlpha *alpha); void clutter_alpha_set_mode (ClutterAlpha *alpha, gulong mode); gulong clutter_alpha_get_mode (ClutterAlpha *alpha); gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha); void clutter_alpha_set_func (ClutterAlpha *alpha, ClutterAlphaFunc func, gpointer data, GDestroyNotify destroy); void clutter_alpha_set_closure (ClutterAlpha *alpha, GClosure *closure); gulong clutter_alpha_register_closure (GClosure *closure); gulong clutter_alpha_register_func (ClutterAlphaFunc func, gpointer data);
"alpha" gdouble : Read "mode" gulong : Read / Write / Construct "timeline" ClutterTimeline* : Read / Write
ClutterAlpha is a class for calculating an floating point value dependent only on the position of a ClutterTimeline.
A ClutterAlpha binds a ClutterTimeline to a progress function which translates the time T into an adimensional factor alpha. The factor can then be used to drive a ClutterBehaviour, which will translate the alpha value into something meaningful for a ClutterActor.
You should provide a ClutterTimeline and bind it to the ClutterAlpha
instance using clutter_alpha_set_timeline()
. You should also set an
"animation mode", either by using the ClutterAnimationMode values that
Clutter itself provides or by registering custom functions using
clutter_alpha_register_func()
.
Instead of a ClutterAnimationMode you may provide a function returning
the alpha value depending on the progress of the timeline, using
clutter_alpha_set_func()
or clutter_alpha_set_closure()
. The alpha
function will be executed each time a new frame in the ClutterTimeline
is reached.
Since the alpha function is controlled by the timeline instance, you can pause, stop or resume the ClutterAlpha from calling the alpha function by using the appropriate functions of the ClutterTimeline object.
ClutterAlpha is used to "drive" a ClutterBehaviour instance, and it is internally used by the ClutterAnimation API.
typedef struct _ClutterAlpha ClutterAlpha;
ClutterAlpha combines a ClutterTimeline and a function. The contents of the ClutterAlpha structure are private and should only be accessed using the provided API.
Since 0.2
gdouble (*ClutterAlphaFunc) (ClutterAlpha *alpha, gpointer user_data);
A function returning a value depending on the position of
the ClutterTimeline bound to alpha
.
|
a ClutterAlpha |
|
user data passed to the function |
Returns : |
a floating point value |
Since 0.2
ClutterAlpha * clutter_alpha_new (void);
Creates a new ClutterAlpha instance. You must set a function
to compute the alpha value using clutter_alpha_set_func()
and
bind a ClutterTimeline object to the ClutterAlpha instance
using clutter_alpha_set_timeline()
.
You should use the newly created ClutterAlpha instance inside a ClutterBehaviour object.
Returns : |
the newly created empty ClutterAlpha instance. |
Since 0.2
ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline, gulong mode);
Creates a new ClutterAlpha instance and sets the timeline and animation mode.
See also clutter_alpha_set_timeline()
and clutter_alpha_set_mode()
.
|
ClutterTimeline timeline |
|
animation mode |
Returns : |
the newly created ClutterAlpha |
Since 1.0
ClutterAlpha * clutter_alpha_new_with_func (ClutterTimeline *timeline, ClutterAlphaFunc func, gpointer data, GDestroyNotify destroy);
Creates a new ClutterAlpha instances and sets the timeline and the alpha function.
This function will not register func
as a global alpha function.
See also clutter_alpha_set_timeline()
and clutter_alpha_set_func()
.
|
a ClutterTimeline |
|
a ClutterAlphaFunc |
|
data to pass to the function, or NULL
|
|
function to call when removing the alpha function, or NULL
|
Returns : |
the newly created ClutterAlpha |
Since 1.0
void clutter_alpha_set_timeline (ClutterAlpha *alpha, ClutterTimeline *timeline);
Binds alpha
to timeline
.
|
A ClutterAlpha |
|
A ClutterTimeline |
Since 0.2
ClutterTimeline * clutter_alpha_get_timeline (ClutterAlpha *alpha);
Gets the ClutterTimeline bound to alpha
.
|
A ClutterAlpha |
Returns : |
a ClutterTimeline instance. transfer none. |
Since 0.2
void clutter_alpha_set_mode (ClutterAlpha *alpha, gulong mode);
Sets the progress function of alpha
using the symbolic value
of mode
, as taken by the ClutterAnimationMode enumeration or
using the value returned by clutter_alpha_register_func()
.
|
a ClutterAlpha |
|
a ClutterAnimationMode |
Since 1.0
gulong clutter_alpha_get_mode (ClutterAlpha *alpha);
Retrieves the ClutterAnimationMode used by alpha
.
|
a ClutterAlpha |
Returns : |
the animation mode |
Since 1.0
gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha);
Query the current alpha value.
|
A ClutterAlpha |
Returns : |
The current alpha value for the alpha |
Since 0.2
void clutter_alpha_set_func (ClutterAlpha *alpha, ClutterAlphaFunc func, gpointer data, GDestroyNotify destroy);
Sets the ClutterAlphaFunc function used to compute
the alpha value at each frame of the ClutterTimeline
bound to alpha
.
This function will not register func
as a global alpha function.
|
A ClutterAlpha |
|
A ClutterAlphaFunc |
|
user data to be passed to the alpha function, or NULL
|
|
notify function used when disposing the alpha function |
Since 0.2
void clutter_alpha_set_closure (ClutterAlpha *alpha, GClosure *closure);
Sets the GClosure used to compute the alpha value at each
frame of the ClutterTimeline bound to alpha
.
|
A ClutterAlpha |
|
A GClosure |
Since 0.8
gulong clutter_alpha_register_closure (GClosure *closure);
GClosure variant of clutter_alpha_register_func()
.
Registers a global alpha function and returns its logical id
to be used by clutter_alpha_set_mode()
or by ClutterAnimation.
The logical id is always greater than CLUTTER_ANIMATION_LAST
.
|
a GClosure |
Returns : |
the logical id of the alpha function |
Since 1.0
gulong clutter_alpha_register_func (ClutterAlphaFunc func, gpointer data);
Registers a global alpha function and returns its logical id
to be used by clutter_alpha_set_mode()
or by ClutterAnimation.
The logical id is always greater than CLUTTER_ANIMATION_LAST
.
|
a ClutterAlphaFunc |
|
user data to pass to func , or NULL
|
Returns : |
the logical id of the alpha function |
Since 1.0
"alpha"
property"alpha" gdouble : Read
The alpha value as computed by the alpha function. The linear interval is 0.0 to 1.0, but the Alpha allows overshooting by one unit in each direction, so the valid interval is -1.0 to 2.0.
Allowed values: [-1,2]
Default value: 0
Since 0.2
"mode"
property"mode" gulong : Read / Write / Construct
The progress function logical id - either a value from the
ClutterAnimationMode enumeration or a value returned by
clutter_alpha_register_func()
.
If CLUTTER_CUSTOM_MODE
is used then the function set using
clutter_alpha_set_closure()
or clutter_alpha_set_func()
will be used.
Since 1.0
"timeline"
property"timeline" ClutterTimeline* : Read / Write
A ClutterTimeline instance used to drive the alpha function.
Since 0.2