Clutter.BindConstraint
Description: Reference for Clutter.BindConstraint

### Class

# ClutterBindConstraint

since: 13

#### 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);

Available since: 13

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

since: 13

#### Instance methods

###### clutter_bind_constraint_get_coordinate

Retrieves the bound coordinate of the constraint.

since: 13

###### clutter_bind_constraint_get_offset

Retrieves the offset set using `clutter_bind_constraint_set_offset()`

since: 13

###### clutter_bind_constraint_get_source

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

since: 13

###### clutter_bind_constraint_set_coordinate

Sets the coordinate to bind in the constraint.

since: 13

###### clutter_bind_constraint_set_offset

Sets the offset to be applied to the constraint.

since: 13

###### clutter_bind_constraint_set_source

Sets the source `ClutterActor` for the constraint.

since: 13

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

###### clutter_constraint_update_preferred_size

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

since: 13

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

###### clutter_actor_meta_get_actor

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

since: 13

###### clutter_actor_meta_get_enabled

Retrieves whether `meta` is enabled.

since: 13

###### clutter_actor_meta_get_name

Retrieves the name set using `clutter_actor_meta_set_name()`

since: 13

###### clutter_actor_meta_set_enabled

Sets whether `meta` should be enabled or not.

since: 13

###### clutter_actor_meta_set_name

Sets the name of `meta`.

since: 13

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

Please see GObject for a full list of methods.

#### Properties

###### Clutter.BindConstraint:coordinate

The coordinate to be bound.

since: 13

###### Clutter.BindConstraint:offset

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

since: 13

###### Clutter.BindConstraint:source

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

since: 13

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

###### Clutter.ActorMeta:actor

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

since: 13

###### Clutter.ActorMeta:enabled

Whether or not the `ClutterActorMeta` is enabled.

since: 13

###### Clutter.ActorMeta:name

The unique name to access the `ClutterActorMeta`.

since: 13

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

since: 2.0

#### Class structure

    struct ClutterBindConstraintClass {
      /* no available fields */
    }

No description available.