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

# Clutter::Behaviour(3pm)

Class for providing behaviours to actors

## NAME

Clutter::Behaviour - Class for providing behaviours to actors

## DESCRIPTION

**Clutter::Behaviour** is the base class for objects controlling the behaviour of actors.  These objects are used primarily to drive a set of actors depending on the position on a timeline, using an "alpha" function; the alpha function is held by the Clutter::Alpha object, which automatically binds a Clutter::Timeline to the function.

## HIERARCHY

```
  Glib::Object
  +----Clutter::Behaviour
```

## METHODS

### $behaviour-\>actors\_foreach ($func, $data=undef)

- •

  `$func` (scalar)

- •

  `$data` (scalar)

### actors = $behaviour-\>get\_actors

### alpha = $behaviour-\>get\_alpha

### $behaviour-\>set\_alpha ($alpha)

- •

  `$alpha` (Clutter::Alpha)

### $behaviour-\>apply ($actor)

- •

  `$actor` (Clutter::Actor)

### boolean = $behaviour-\>is\_applied ($actor)

- •

  `$actor` (Clutter::Actor)

### integer = $behaviour-\>get\_n\_actors

### actor = $behaviour-\>get\_nth\_actor ($index)

- •

  `$index` (integer)

### $behaviour-\>remove ($actor)

- •

  `$actor` (Clutter::Actor)

### $behaviour-\>remove\_all

## PROPERTIES

- 'alpha' (Clutter::Alpha : readable / writable / private)

  Alpha Object to drive the behaviour

## SIGNALS

- **applied** (Clutter::Behaviour, Clutter::Actor)

  - **removed** (Clutter::Behaviour, Clutter::Actor)

  ## DERIVING NEW BEHAVIOURS

Clutter provides various behaviours, like Clutter::Behaviour::Opacity, Clutter::Behaviour::Path and Clutter::Behaviour::Scale. You may derive a new behaviour from any of these, or directly from the Clutter::Behaviour class itself.

The new behaviour must be a GObject, so you must follow the normal procedure for creating a new Glib::Object (i.e., either using the Glib::Object::Subclass pragmatic module or by directly calling the Glib::Type::register\_object function).  The new subclass can customize the behaviour by providing a new implementation of the following method:

- **ALPHA\_NOTIFY ($behaviour, $alpha\_value)**

  - o $behaviour (Clutter::Behaviour)

    - o $alpha\_value (float) The value computed by the alpha function

    This is called each time the value of the alpha function held by the Clutter::Alpha object bound to the behaviour changes.  You should update the property, or the properties, of the actors controlled by your behaviour using *alpha\_value*, scaled accordingly.

## SEE ALSO

Clutter, Glib::Object

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