Emmanuele Bassi > Clutter-0.820 > xs/ClutterBehaviour.xs

Download:
Clutter-0.820.tar.gz

Annotate this POD

CPAN RT

New  3
Open  2
View/Report Bugs
Source   Latest Release: Clutter-1.002

DESCRIPTION ^

Clutter::Behaviour is the base class for objects controlling the behaviour of actors. These objects are used primarily to drive a set of actors depending on the position on a timeline, using an "alpha" function; the alpha function is held by the Clutter::Alpha object, which automatically binds a Clutter::Timeline to the function.

DERIVING NEW BEHAVIOURS ^

Clutter provides various behaviours, like Clutter::Behaviour::Opacity, Clutter::Behaviour::Path and Clutter::Behaviour::Scale. You may derive a new behaviour from any of these, or directly from the Clutter::Behaviour class itself.

The new behaviour must be a GObject, so you must follow the normal procedure for creating a new Glib::Object (i.e., either using the Glib::Object::Subclass pragmatic module or by directly calling the Glib::Type::register_object function). The new subclass can customize the behaviour by providing a new implementation of the following method:

ALPHA_NOTIFY ($behaviour, $alpha_value)
o $behaviour (Clutter::Behaviour)
o $alpha_value (integer) The value computed by the alpha function

This is called each time the value of the alpha function held by the Clutter::Alpha object bound to the behaviour changes. You should update the property, or the properties, of the actors controlled by your behaviour using alpha_value, scaled accordingly.

syntax highlighting: