---
name: "Clutter::Alpha"
section: "3pm"
platform: "linux"
package: "libclutter-perl"
version: "1.002-1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/Clutter::Alpha"
---

# Clutter::Alpha(3pm)

A class for calculating a value as a function of time

## 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.
