NAME
Clutter::Alpha - A class for calculating a value as a function of time
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 -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.
HIERARCHY
Glib::Object+----Glib::InitiallyUnowned+----Clutter::Alpha
METHODS
alpha = Clutter::Alpha->new ($timeline=undef, $mode=undef)
- •
-
$timeline(Clutter::Timeline)
- •
-
$mode(scalar)
double = $alpha->get_alpha
$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.
scalar = $alpha->get_mode
$alpha->set_mode ($mode)
- •
-
$mode(scalar)
unsigned = $class->register_func ($func, $data)
- •
-
$func(scalar)
- •
-
$data(scalar)
timeline = $alpha->get_timeline
$alpha->set_timeline ($timeline)
- •
-
$timeline(Clutter::Timeline)
PROPERTIES
- 'alpha' (double : readable / private)
-
Alpha value
- 'mode' (Glib::ULong : readable / writable / construct / private)
-
Progress mode
- 'timeline' (Clutter::Timeline : readable / writable / private)
-
Timeline used by the alpha
ENUMS AND FLAGS
enum Clutter::AnimationMode
- •
-
'custom-mode' / 'CLUTTER_CUSTOM_MODE'
- •
-
'linear' / 'CLUTTER_LINEAR'
- •
-
'ease-in-quad' / 'CLUTTER_EASE_IN_QUAD'
- •
-
'ease-out-quad' / 'CLUTTER_EASE_OUT_QUAD'
- •
-
'ease-in-out-quad' / 'CLUTTER_EASE_IN_OUT_QUAD'
- •
-
'ease-in-cubic' / 'CLUTTER_EASE_IN_CUBIC'
- •
-
'ease-out-cubic' / 'CLUTTER_EASE_OUT_CUBIC'
- •
-
'ease-in-out-cubic' / 'CLUTTER_EASE_IN_OUT_CUBIC'
- •
-
'ease-in-quart' / 'CLUTTER_EASE_IN_QUART'
- •
-
'ease-out-quart' / 'CLUTTER_EASE_OUT_QUART'
- •
-
'ease-in-out-quart' / 'CLUTTER_EASE_IN_OUT_QUART'
- •
-
'ease-in-quint' / 'CLUTTER_EASE_IN_QUINT'
- •
-
'ease-out-quint' / 'CLUTTER_EASE_OUT_QUINT'
- •
-
'ease-in-out-quint' / 'CLUTTER_EASE_IN_OUT_QUINT'
- •
-
'ease-in-sine' / 'CLUTTER_EASE_IN_SINE'
- •
-
'ease-out-sine' / 'CLUTTER_EASE_OUT_SINE'
- •
-
'ease-in-out-sine' / 'CLUTTER_EASE_IN_OUT_SINE'
- •
-
'ease-in-expo' / 'CLUTTER_EASE_IN_EXPO'
- •
-
'ease-out-expo' / 'CLUTTER_EASE_OUT_EXPO'
- •
-
'ease-in-out-expo' / 'CLUTTER_EASE_IN_OUT_EXPO'
- •
-
'ease-in-circ' / 'CLUTTER_EASE_IN_CIRC'
- •
-
'ease-out-circ' / 'CLUTTER_EASE_OUT_CIRC'
- •
-
'ease-in-out-circ' / 'CLUTTER_EASE_IN_OUT_CIRC'
- •
-
'ease-in-elastic' / 'CLUTTER_EASE_IN_ELASTIC'
- •
-
'ease-out-elastic' / 'CLUTTER_EASE_OUT_ELASTIC'
- •
-
'ease-in-out-elastic' / 'CLUTTER_EASE_IN_OUT_ELASTIC'
- •
-
'ease-in-back' / 'CLUTTER_EASE_IN_BACK'
- •
-
'ease-out-back' / 'CLUTTER_EASE_OUT_BACK'
- •
-
'ease-in-out-back' / 'CLUTTER_EASE_IN_OUT_BACK'
- •
-
'ease-in-bounce' / 'CLUTTER_EASE_IN_BOUNCE'
- •
-
'ease-out-bounce' / 'CLUTTER_EASE_OUT_BOUNCE'
- •
-
'ease-in-out-bounce' / 'CLUTTER_EASE_IN_OUT_BOUNCE'
- •
-
'animation-last' / 'CLUTTER_ANIMATION_LAST'
SEE ALSO
Clutter, Glib::Object, Glib::InitiallyUnowned
COPYRIGHT
Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
Copyright (C) 2009 Intel Corporation
This module is free software; you can redistribute it and/or modify it under the terms of either:
- •
-
the GNU Lesser General Public Library version 2.1; or
- •
-
the Artistic License, version 2.0.
See Clutter for the full copyright notice.