Next: ClutterChildMeta, Previous: ClutterBehaviourScale, Up: Top
Class for providing behaviours to actors
<clutter-behaviour> is the base class for implementing behaviours. A
behaviour is a controller object for <clutter-actor>s; you can use a
behaviour to control one or more properties of an actor (such as its opacity, or
its position). A <clutter-behaviour> is driven by an "alpha function"
stored inside a <clutter-alpha> object; an alpha function is a function
depending solely on time. The alpha function computes a value which is then
applied to the properties of the actors driven by a behaviour.
Clutter provides some pre-defined behaviours, like
<clutter-behaviour-path>, which controls the position of a set of actors
making them "walk" along a set of nodes; <clutter-behaviour-opacity>,
which controls the opacity of a set of actors; <clutter-behaviour-scale>,
which controls the width and height of a set of actors.
To visualize the effects of different alpha functions on a
<clutter-behaviour> implementation it is possible to take the
<clutter-behaviour-path> as an example:
(The missing figure, behaviour-path-alpha
The actors position between the path's end points directly correlates to the
<clutter-alpha>'s current alpha value driving the behaviour. With the
<clutter-alpha>'s function set to ‘CLUTTER_ALPHA_RAMP_INC’ the actor
will follow the path at a constant velocity, but when changing to
‘CLUTTER_ALPHA_SINE_INC’ the actor initially accelerates before quickly
decelerating.
In order to implement a new behaviour you should subclass
<clutter-behaviour> and override the "alpha_notify" virtual function;
inside the overridden function you should obtain the alpha value from the
<clutter-alpha> instance bound to the behaviour and apply it to the
desiderd property (or properties) of every actor controlled by the behaviour.
<clutter-behaviour> is available since Clutter 0.2
Derives from
<gobject>.This class defines the following slots:
alpha- Alpha Object to drive the behaviour
<clutter-actor>)The ::apply signal is emitted each time the behaviour is applied to an actor.
Since 0.4
<clutter-actor>)The ::removed signal is emitted each time a behaviour is not applied to an actor anymore.
<clutter-behaviour>) (actor <clutter-actor>)Applies behave to actor. This function adds a reference on the actor.
- behave
- a
<clutter-behaviour>- actor
- a
<clutter-actor>Since 0.2
<clutter-behaviour>) (actor <clutter-actor>)Removes actor from the list of
<clutter-actor>s to which behave applies. This function removes a reference on the actor.
- behave
- a
<clutter-behaviour>- actor
- a
<clutter-actor>Since 0.2
<clutter-behaviour>)Removes every actor from the list that behave holds.
- behave
- a
<clutter-behaviour>Since 0.4
<clutter-behaviour>) (actor <clutter-actor>) (ret bool)Check if behave applied to actor.
- behave
- a
<clutter-behaviour>- actor
- a
<clutter-actor>- ret
- TRUE if actor has behaviour. FALSE otherwise.
Since 0.4
<clutter-behaviour>) (ret gslist-of)Retrieves all the actors to which behave applies. It is not recommended for derived classes to use this in there alpha notify method but use
<clutter-behaviour-actors-foreach>as it avoids alot of needless allocations.
- behave
- a
<clutter-behaviour>- ret
- a list of actors. You should free the returned list with
g-slist-freewhen finished using it.Since 0.2
<clutter-behaviour>) (ret int)Gets the number of actors this behaviour is applied too.
- behave
- a
<clutter-behaviour>- ret
- The number of applied actors
Since 0.2
<clutter-behaviour>) (index_ int) (ret <clutter-actor>)Gets an actor the behaviour was applied to referenced by index num.
- behave
- a
<clutter-behaviour>- index
- the index of an actor this behaviour is applied too.
- ret
- A Clutter actor or NULL if index is invalid.
Since 0.2
<clutter-behaviour>) (ret <clutter-alpha>)Retrieves the
<clutter-alpha>object bound to behave.
- behave
- a
<clutter-behaviour>- ret
- a
<clutter-alpha>object, or ‘#f’ if no alpha object has been bound to this behaviour.Since 0.2
<clutter-behaviour>) (alpha <clutter-alpha>)Binds alpha to a
<clutter-behaviour>. The<clutter-alpha>object is what makes a behaviour work: for each tick of the timeline used by<clutter-alpha>a new value of the alpha parameter is computed by the alpha function; the value should be used by the<clutter-behaviour>to update one or more properties of the actors to which the behaviour applies.
- behave
- a
<clutter-behaviour>- alpha
- a
<clutter-alpha>or ‘#f’ to unset a previously set alphaSince 0.2