Emmanuele Bassi > Clutter-0.800 > xs/ClutterAlpha.xs

Download:
Clutter-0.800.tar.gz

Annotate this POD

CPAN RT

New  2
Open  2
View Bugs
Report a bug
Source   Latest Release: Clutter-1.002

DESCRIPTION ^

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 0 and Clutter::Alpha::MAX_ALPHA.

This is an example of a simple alpha function that increments linearly:

  sub linear {
      my $alpha    = shift;
      my $timeline = $alpha->get_timeline();

      return int($timeline->get_progress() * Clutter::Alpha->MAX_ALPHA);
  }

Alphas are used by Clutter::Behaviours to create implicit animations. By changing the alpha function inside a Clutter::Alpha object it's possible to change the speed of the animation.

Clutter provides some common alpha function, like ramps, sines, smoothsteps, exponential and square waves.