
The Clutter::Alpha class binds together a Clutter::Timeline and a function. At each frame of the timeline, the Alpha object will call the given function, which will receive the value of the frame and must return a value between -1.0 and 2.0.
This is an example of a simple alpha function that increments linearly:
sub linear {
my ($alpha) = shift;
return $alpha->get_timeline()->get_progress();
}
A slightly more useful example:
use Math::Trig;
sub sine {
my ($alpha) = @_;
return sin($alpha->get_timeline()->get_progress() * pi);
}
Instead of using real functions you can use a logical id for common easing functions, like: Clutter::LINEAR, Clutter::EASE_IN_CUBIC, Clutter::EASE_OUT_BOUNCE, etc. See Clutter::AnimationMode.
Alphas are used by Clutter::Behaviours and Clutter::Animationss to create implicit animations. By changing the alpha function inside a Clutter::Alpha object it's possible to change the progress of the animation.