Clutter::Alpha.3pm

Langue: en

Version: 2008-10-14 (ubuntu - 08/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Clutter::Alpha

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.

HIERARCHY

   Glib::Object
   +----Glib::InitiallyUnowned
        +----Clutter::Alpha
 
 

METHODS


alpha = Clutter::Alpha->new ($timeline=undef, $func=undef, $data=undef)


alpha = Clutter::Alpha->new ($timeline=undef, $func=undef, $data=undef)

$timeline (Clutter::Timeline)
$func (scalar) a code reference or undef
$data (scalar) a scalar to pass to func or undef

Creates a new Clutter::Alpha instance binding timeline to the function referenced by func. The function reference can be a custom function or one of the alpha functions provided by Clutter, for instance:
   \&Clutter::Alpha::ramp_inc
   \&Clutter::Alpha::sine
   \&Clutter::Alpha::exp_dec
 
 

The function reference must have a signature like:

   sub alpha_function {
       my ($alpha, $data) = @_;
 
       # $alpha is the Clutter::Alpha instance
       # $data is the scalar passed
 
       return $integer;
   }
 
 

Where integer is an unsigned integer between 0 and MAX_ALPHA.


unsigned = Clutter::Alpha->MAX_ALPHA


unsigned = $alpha->get_alpha


unsigned = $alpha->get_alpha


unsigned = $alpha->exp_dec (...)


unsigned = $alpha->exp_dec (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->exp_inc (...)


unsigned = $alpha->exp_inc (...)

... (list) other arguments ignored (data, etc.)

$alpha->set_func ($func, $data=undef)


$alpha->set_func ($func, $data=undef)

$func (scalar) a code reference or undef
$data (scalar) a scalar to pass to func or undef

Sets the alpha function for alpha.

unsigned = $alpha->ramp (...)


unsigned = $alpha->ramp (...)

... (list)

unsigned = $alpha->ramp_dec (...)


unsigned = $alpha->ramp_dec (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->ramp_inc (...)


unsigned = $alpha->ramp_inc (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->sine (...)


unsigned = $alpha->sine (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->sine_dec (...)


unsigned = $alpha->sine_dec (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->sine_half (...)


unsigned = $alpha->sine_half (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->sine_inc (...)


unsigned = $alpha->sine_inc (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->smoothstep_dec (...)


unsigned = $alpha->smoothstep_dec (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->smoothstep_inc (...)


unsigned = $alpha->smoothstep_inc (...)

... (list) other arguments ignored (data, etc.)

unsigned = $alpha->square (...)


unsigned = $alpha->square (...)

... (list) other arguments ignored (data, etc.)

timeline = $alpha->get_timeline


timeline = $alpha->get_timeline


$alpha->set_timeline ($timeline)


$alpha->set_timeline ($timeline)

$timeline (Clutter::Timeline)

PROPERTIES

'alpha' (Glib::UInt : readable / private)
Alpha value
'timeline' (Clutter::Timeline : readable / writable / private)
Timeline

SEE ALSO

Clutter, Glib::Object, Glib::InitiallyUnowned Copyright (C) 2006 OpenedHand Ltd.

This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Library version 2.1, or under the terms of the Artistic License. See Clutter for the full copyright notice.