### Class

# Clutter BindConstraint

#### Description [src]

    final class Clutter.BindConstraint : Clutter.Constraint {
      /* No available fields */
    }

A constraint binding the position or size of an actor

`ClutterBindConstraint` is a `ClutterConstraint` that binds the position or the size of the `ClutterActor` to which it is applied to the the position or the size of another `ClutterActor`, or “source”.

An offset can be applied to the constraint, to avoid overlapping. The offset can also be animated. For instance, the following code will set up three actors to be bound to the same origin:

    // source
    rect[0] = clutter_actor_new ();
    clutter_actor_set_background_color (rect[0], &red_color);
    clutter_actor_set_position (rect[0], x_pos, y_pos);
    clutter_actor_set_size (rect[0], 100, 100);

    // second rectangle
    rect[1] = clutter_actor_new ();
    clutter_actor_set_background_color (rect[1], &green_color);
    clutter_actor_set_size (rect[1], 100, 100);
    clutter_actor_set_opacity (rect[1], 0);

    constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_X, 0.0);
    clutter_actor_add_constraint_with_name (rect[1], "green-x", constraint);
    constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0);
    clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint);

    // third rectangle
    rect[2] = clutter_actor_new ();
    clutter_actor_set_background_color (rect[2], &blue_color);
    clutter_actor_set_size (rect[2], 100, 100);
    clutter_actor_set_opacity (rect[2], 0);

    constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_X, 0.0);
    clutter_actor_add_constraint_with_name (rect[2], "blue-x", constraint);
    constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0);
    clutter_actor_add_constraint_with_name (rect[2], "blue-y", constraint);

The following code animates the second and third rectangles to “expand” them horizontally from underneath the first rectangle:

    clutter_actor_animate (rect[1], CLUTTER_EASE_OUT_CUBIC, 250,
                           "@constraints.green-x.offset", 100.0,
                           "opacity", 255,
                           NULL);
    clutter_actor_animate (rect[2], CLUTTER_EASE_OUT_CUBIC, 250,
                           "@constraints.blue-x.offset", 200.0,
                           "opacity", 255,
                           NULL);

#### Ancestors

- ClutterConstraint
- ClutterActorMeta
- GInitiallyUnowned
- GObject

#### Constructors

###### clutter_bind_constraint_new

Creates a new constraint, binding a `ClutterActor`‘s position to the given `coordinate` of the position of `source`.

#### Instance methods

###### clutter_bind_constraint_get_coordinate

Retrieves the bound coordinate of the constraint.

###### clutter_bind_constraint_get_offset

Retrieves the offset set using `clutter_bind_constraint_set_offset()`

###### clutter_bind_constraint_get_source

Retrieves the `ClutterActor` set using `clutter_bind_constraint_set_source()`

###### clutter_bind_constraint_set_coordinate

Sets the coordinate to bind in the constraint.

###### clutter_bind_constraint_set_offset

Sets the offset to be applied to the constraint.

###### clutter_bind_constraint_set_source

Sets the source `ClutterActor` for the constraint.

##### Methods inherited from ClutterConstraint (1)

###### clutter_constraint_update_preferred_size

Asks the `constraint` to update the size request of a `ClutterActor`.

##### Methods inherited from ClutterActorMeta (5)

###### clutter_actor_meta_get_actor

Retrieves a pointer to the `ClutterActor` that owns `meta`.

###### clutter_actor_meta_get_enabled

Retrieves whether `meta` is enabled.

###### clutter_actor_meta_get_name

Retrieves the name set using `clutter_actor_meta_set_name()`

###### clutter_actor_meta_set_enabled

Sets whether `meta` should be enabled or not.

###### clutter_actor_meta_set_name

Sets the name of `meta`.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Clutter.BindConstraint:coordinate

The coordinate to be bound.

###### Clutter.BindConstraint:offset

The offset, in pixels, to be applied to the binding.

###### Clutter.BindConstraint:source

The `ClutterActor` used as the source for the binding.

##### Properties inherited from ClutterActorMeta (3)

###### Clutter.ActorMeta:actor

The `ClutterActor` attached to the `ClutterActorMeta` instance.

###### Clutter.ActorMeta:enabled

Whether or not the `ClutterActorMeta` is enabled.

###### Clutter.ActorMeta:name

The unique name to access the `ClutterActorMeta`.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct ClutterBindConstraintClass {
      /* no available fields */
    }

No description available.