## ClutterAlpha

ClutterAlpha — A class for calculating an alpha value as a function of time.

## Synopsis

                        ClutterAlpha;
                        ClutterAlphaClass;
    ClutterAlpha*       clutter_alpha_new                   (void);
    ClutterAlpha*       clutter_alpha_new_full              (ClutterTimeline *timeline,
                                                             ClutterAlphaFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);
    guint32             clutter_alpha_get_alpha             (ClutterAlpha *alpha);
    #define             CLUTTER_ALPHA_MAX_ALPHA
    guint32             (*ClutterAlphaFunc)                 (ClutterAlpha *alpha,
                                                             gpointer user_data);
    void                clutter_alpha_set_func              (ClutterAlpha *alpha,
                                                             ClutterAlphaFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);
    void                clutter_alpha_set_closure           (ClutterAlpha *alpha,
                                                             GClosure *closure);
    void                clutter_alpha_set_timeline          (ClutterAlpha *alpha,
                                                             ClutterTimeline *timeline);
    ClutterTimeline*    clutter_alpha_get_timeline          (ClutterAlpha *alpha);
    #define             CLUTTER_ALPHA_RAMP_INC
    guint32             clutter_ramp_inc_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_RAMP_DEC
    guint32             clutter_ramp_dec_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_RAMP
    guint32             clutter_ramp_func                   (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SINE
    guint32             clutter_sine_func                   (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SINE_INC
    guint32             clutter_sine_inc_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SINE_DEC
    guint32             clutter_sine_dec_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SINE_HALF
    guint32             clutter_sine_half_func              (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SQUARE
    guint32             clutter_square_func                 (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SMOOTHSTEP_INC
    guint32             clutter_smoothstep_inc_func         (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_SMOOTHSTEP_DEC
    guint32             clutter_smoothstep_dec_func         (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_EXP_INC
    guint32             clutter_exp_inc_func                (ClutterAlpha *alpha,
                                                             gpointer dummy);
    #define             CLUTTER_ALPHA_EXP_DEC
    guint32             clutter_exp_dec_func                (ClutterAlpha *alpha,
                                                             gpointer dummy);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ClutterAlpha

## Properties

      "alpha"                    guint                 : Read
      "timeline"                 ClutterTimeline*      : Read / Write

## Description

ClutterAlpha is a class for calculating an integer value between 0 and `CLUTTER_ALPHA_MAX_ALPHA` as a function of time. You should provide a ClutterTimeline and bind it to the ClutterAlpha object; you should also provide a function returning the alpha value depending on the position inside the timeline; this 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 or stop the ClutterAlpha from calling the alpha function by controlling the ClutterTimeline object.

ClutterAlpha is used to "drive" a ClutterBehaviour instance.

Figure 3. Graphic representation of some alpha functions

## Details

### ClutterAlpha

    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

### ClutterAlphaClass

    typedef struct {
    } ClutterAlphaClass;

Base class for ClutterAlpha

Since 0.2

### clutter_alpha_new ()

    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

### clutter_alpha_new_full ()

    ClutterAlpha*       clutter_alpha_new_full              (ClutterTimeline *timeline,
                                                             ClutterAlphaFunc func,
                                                             gpointer data,
                                                             GDestroyNotify destroy);

Creates a new ClutterAlpha instance and sets the timeline and alpha function.

`timeline` : | ClutterTimeline timeline
`func` : | ClutterAlphaFunc alpha function
`data` : | data to be passed to the alpha function
`destroy` : | notify to be called when removing the alpha function
Returns : | the newly created ClutterAlpha

Since 0.2

### clutter_alpha_get_alpha ()

    guint32             clutter_alpha_get_alpha             (ClutterAlpha *alpha);

Query the current alpha value.

`alpha` : | A ClutterAlpha
Returns : | The current alpha value for the alpha

Since 0.2

### CLUTTER_ALPHA_MAX_ALPHA

    #define CLUTTER_ALPHA_MAX_ALPHA 0xffff

Maximum value returned by ClutterAlphaFunc

Since 0.2

### ClutterAlphaFunc ()

    guint32             (*ClutterAlphaFunc)                 (ClutterAlpha *alpha,
                                                             gpointer user_data);

A function of time, which returns a value between 0 and `CLUTTER_ALPHA_MAX_ALPHA`.

`alpha` : | a ClutterAlpha
`user_data` : | user data passed to the function
Returns : | an unsigned integer value, between 0 and `CLUTTER_ALPHA_MAX_ALPHA`.

Since 0.2

### clutter_alpha_set_func ()

    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`.

`alpha` : | A ClutterAlpha
`func` : | A ClutterAlphaAlphaFunc
`data` : | user data to be passed to the alpha function, or `NULL`
`destroy` : | notify function used when disposing the alpha function

Since 0.2

### clutter_alpha_set_closure ()

    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`.

`alpha` : | A ClutterAlpha
`closure` : | A GClosure

Since 0.8

### clutter_alpha_set_timeline ()

    void                clutter_alpha_set_timeline          (ClutterAlpha *alpha,
                                                             ClutterTimeline *timeline);

Binds `alpha` to `timeline`.

`alpha` : | A ClutterAlpha
`timeline` : | A ClutterTimeline

Since 0.2

### clutter_alpha_get_timeline ()

    ClutterTimeline*    clutter_alpha_get_timeline          (ClutterAlpha *alpha);

Gets the ClutterTimeline bound to `alpha`.

`alpha` : | A ClutterAlpha
Returns : | a ClutterTimeline instance

Since 0.2

### CLUTTER_ALPHA_RAMP_INC

    #define CLUTTER_ALPHA_RAMP_INC       clutter_ramp_inc_func

Convenience symbol for `clutter_ramp_inc_func()`.

Since 0.2

### clutter_ramp_inc_func ()

    guint32             clutter_ramp_inc_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a monotonic increasing ramp. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.2

### CLUTTER_ALPHA_RAMP_DEC

    #define CLUTTER_ALPHA_RAMP_DEC       clutter_ramp_dec_func

Convenience symbol for `clutter_ramp_dec_func()`.

Since 0.2

### clutter_ramp_dec_func ()

    guint32             clutter_ramp_dec_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a monotonic decreasing ramp. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.2

### CLUTTER_ALPHA_RAMP

    #define CLUTTER_ALPHA_RAMP           clutter_ramp_func

Convenience symbol for `clutter_ramp_func()`.

Since 0.2

### clutter_ramp_func ()

    guint32             clutter_ramp_func                   (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a full ramp function (increase for half the time, decrease for the remaining half). You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.2

### CLUTTER_ALPHA_SINE

    #define CLUTTER_ALPHA_SINE           clutter_sine_func

Convenience symbol for `clutter_sine_func()`.

Since 0.2

### clutter_sine_func ()

    guint32             clutter_sine_func                   (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a sine wave. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.2

### CLUTTER_ALPHA_SINE_INC

    #define CLUTTER_ALPHA_SINE_INC       clutter_sine_inc_func

Convenience symbol for `clutter_sine_inc_func()`.

Since 0.2

### clutter_sine_inc_func ()

    guint32             clutter_sine_inc_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a sine wave over interval [0, pi / 2]. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.2

### CLUTTER_ALPHA_SINE_DEC

    #define CLUTTER_ALPHA_SINE_DEC       clutter_sine_dec_func

Convenience symbol for `clutter_sine_dec_func()`.

Since 0.2

### clutter_sine_dec_func ()

    guint32             clutter_sine_dec_func               (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a sine wave over interval [pi / 2, pi]. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.4

### CLUTTER_ALPHA_SINE_HALF

    #define CLUTTER_ALPHA_SINE_HALF      clutter_sine_half_func

Convenience symbol for `clutter_sine_half_func()`.

Since 0.4

### clutter_sine_half_func ()

    guint32             clutter_sine_half_func              (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a sine wave over interval [0, pi]. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.4

### CLUTTER_ALPHA_SQUARE

    #define CLUTTER_ALPHA_SQUARE         clutter_square_func

Convenience symbol for `clutter_square_func()`.

Since 0.4

### clutter_square_func ()

    guint32             clutter_square_func                 (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a square wave. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value

Since 0.4

### CLUTTER_ALPHA_SMOOTHSTEP_INC

    #define CLUTTER_ALPHA_SMOOTHSTEP_INC clutter_smoothstep_inc_func

Convenience symbol for `clutter_smoothstep_inc_func()`.

Since 0.4

### clutter_smoothstep_inc_func ()

    guint32             clutter_smoothstep_inc_func         (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a smoothstep curve. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused
Returns : | an alpha value

Since 0.4

### CLUTTER_ALPHA_SMOOTHSTEP_DEC

    #define CLUTTER_ALPHA_SMOOTHSTEP_DEC clutter_smoothstep_dec_func

Convenience symbol for `clutter_smoothstep_dec_func()`.

Since 0.4

### clutter_smoothstep_dec_func ()

    guint32             clutter_smoothstep_dec_func         (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a downward smoothstep curve. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused
Returns : | an alpha value

Since 0.4

### CLUTTER_ALPHA_EXP_INC

    #define CLUTTER_ALPHA_EXP_INC        clutter_exp_inc_func

Convenience symbol for `clutter_exp_inc_func()`

Since 0.4

### clutter_exp_inc_func ()

    guint32             clutter_exp_inc_func                (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a 2^x curve. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.4

### CLUTTER_ALPHA_EXP_DEC

    #define CLUTTER_ALPHA_EXP_DEC        clutter_exp_dec_func

Convenience symbold for `clutter_exp_dec_func()`.

Since 0.4

### clutter_exp_dec_func ()

    guint32             clutter_exp_dec_func                (ClutterAlpha *alpha,
                                                             gpointer dummy);

Convenience alpha function for a decreasing 2^x curve. You can use this function as the alpha function for `clutter_alpha_set_func()`.

`alpha` : | a ClutterAlpha
`dummy` : | unused argument
Returns : | an alpha value.

Since 0.4

## Property Details

### The `"alpha"` property

      "alpha"                    guint                 : Read

The alpha value as computed by the alpha function.

Allowed values: <= 65535

Default value: 0

Since 0.2

### The `"timeline"` property

      "timeline"                 ClutterTimeline*      : Read / Write

A ClutterTimeline instance used to drive the alpha function.

Since 0.2