## Duik.Constraint

Constraint tools.

View Source DuAEF_Duik_api.jsxinc, line 39420

# Members

Type: `int`

#### # static IKType

The types of IK for three-layer chains.

##### Properties:

Name | Type | Description
--- | --- | ---
`ONE_TWO` | `int` |
`TWO_ONE` | `int` |
`FK` | `int` |
`BEZIER_IK` | `int` |
`BEZIER_FK` | `int` |

View Source DuAEF_Duik_api.jsxinc, line 39426

# Methods

#### # static alignLayers(positionopt, rotationopt, scaleopt, opacityopt)

Align selected Layers to the last selected one

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`position` | `Boolean` | <optional> | true | whether to align the position.
`rotation` | `Boolean` | <optional> | true | whether to align the rotation.
`scale` | `Boolean` | <optional> | true | whether to align the scale.
`opacity` | `Boolean` | <optional> | true | whether to align the opacity.

View Source DuAEF_Duik_api.jsxinc, line 39891

#### # static applyLocatorValues(layersopt, disableopt)

Sets the current values of the locators. This fixes some bugs when unparenting layers parented to the locators.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Layer` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layer(s). If omitted, will use all selected layers in the comp
`disable` | `boolean` | <optional> | true | whether to disable the expressions after having applied the values

View Source DuAEF_Duik_api.jsxinc, line 42857

#### # static autoParent(orphansOnlyopt, layersopt)

Auto-Parent. Parent selected layers to the last selected one.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`orphansOnly` | `Boolean` | <optional> | false | When true, parent only the orphans to the last selected layers
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> |  | The layers

View Source DuAEF_Duik_api.jsxinc, line 42572

#### # static bezierFK(layers, goalopt, controlleropt, showGuidesopt, rootControlleropt) → {Array.<Layer>}

Creates a bezier fk on the layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` |  |  | The layers, ordered from root to end
`goal` | `Layer` | `null` | <optional> |  | The goal layer, at the end of the IK
`controller` | `Layer` | `null` | <optional> |  | The layer to use as controller, can be automatically created. Must be provided if goal is undefined.
`showGuides` | `Boolean` | <optional> | true | Set to false to hide guides on the controllers (and improve performance)
`rootController` | `Layer` | `null` | <optional> |  | The layer to use as root controller, can be automatically created.

View Source DuAEF_Duik_api.jsxinc, line 42297

Returns:
The controllers [curve,end,root,rootpos, rootrot]
Type: `Array.<Layer>`

#### # static bezierIK(layers, goalopt, controlleropt, showGuidesopt) → {Array.<Layer>}

Creates a bezier ik on the layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` |  |  | The layers, ordered from root to end
`goal` | `Layer` | `null` | <optional> |  | The goal layer, at the end of the IK
`controller` | `Layer` | `null` | <optional> |  | The layer to use as controller, can be automatically created. Must be provided if goal is undefined.
`showGuides` | `Boolean` | <optional> | true | Set to false to hide guides on the controllers (and improve performance)

View Source DuAEF_Duik_api.jsxinc, line 42011

Returns:
The controllers [curve,end,root]
Type: `Array.<Layer>`

#### # static connector(props, masterProp, minopt, maxopt, axisopt, typeopt) → {PropertyGroup}

Connects the properties to a master property.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`props` | `Array.<DuAEProperty>` | `DuList.<DuAEProperty>` |  |  | The child properties
`masterProp` | `Property` | `DuAEProperty` |  |  | The parent property
`min` | `float` | <optional> | 0 | The minimum value
`max` | `float` | <optional> | 100 | The maximum value
`axis` | `DuAE.Axis` | <optional> | DuAE.Axis.X | The axis or channel to connect
`type` | `DuAE.Type` | <optional> | DuAE.Type.VALUE | The type

View Source DuAEF_Duik_api.jsxinc, line 43385

Returns:
The controlling effect created
Type: `PropertyGroup`

#### # static createList(prop) → {DuAEProperty}

Adds a list on a property

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | `DuAEProperty` | The Property

View Source DuAEF_Duik_api.jsxinc, line 39463

Returns:
The list effect
Type: `DuAEProperty`

#### # static createLocator(layerOrCompopt) → {ShapeLayer}

Creates a new locator linked to the layer

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layerOrComp` | `Layer` | `CompItem` | <optional> | The layer or the containing comp

View Source DuAEF_Duik_api.jsxinc, line 42753

Returns:
The locator
Type: `ShapeLayer`

#### # static disableLocator(layersopt, disableopt)

Disables the locator. Disable the transform expressions

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Layer` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | DuAEComp.getSelectedLayers() | The layer(s). If omitted, will use all selected layers in the comp
`disable` | `boolean` | <optional> | true |

View Source DuAEF_Duik_api.jsxinc, line 42891

#### # static exposeTransform(compopt, layersopt) → {Array.<ShapeLayer>}

Expose Transform

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`comp` | `CompItem` | <optional> | The composition where to create the expose transform controller. The active composition by default.
`layers` | `Array.<Layer>` | <optional> | The layer with the transformation to expose. The selected layers by default. Can be an empty list too, in this case the Expose Transform controller is not set to measure any layer.

View Source DuAEF_Duik_api.jsxinc, line 39922

Returns:
The list of the new Expose Transform controllers. One per given layer.
Type: `Array.<ShapeLayer>`

#### # static extractLocator(locator, preCompLayer, useEssentialPropertiesopt) → {ShapeLayer}

Extracts one locator from a precomposition

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`locator` | `ShapeLayer` |  |  | The locator to extract
`preCompLayer` | `AVLayer` |  |  | The precomposition layer
`useEssentialProperties` | `Boolean` | <optional> | true | true to extract using master properties instead of expressions (ignored in Ae < 15.1, false by default if 15.1 <= Ae < 17 and true by default in Ae >= 17)

View Source DuAEF_Duik_api.jsxinc, line 42793

Returns:
The extracted locator
Type: `ShapeLayer`

#### # static extractLocators(useEssentialPropertiesopt, precompLayersopt)

Extract Locators

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`useEssentialProperties` | `Boolean` | <optional> | whether to use essential properties instead of expressions to extract the controllers. True by default if Ae >= 17.0
`precompLayers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers

View Source DuAEF_Duik_api.jsxinc, line 42763

#### # static fk(layersopt, controlleropt) → {Layer}

Creates a FK with auto-overlapping and its controller on the layers.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers, already parented or ordered from root (at index 0) to end
`controller` | `Layer` | <optional> | An already existing controller.

View Source DuAEF_Duik_api.jsxinc, line 42372

Returns:
The controller of the FK.
Type: `Layer`

#### # static ik(typeopt, forceBezieropt, layersopt, controlleropt, bezierFKopt) → {Array.<Layer>}

Creates an IK on the layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | `Duik.IKType` | <optional> | Duik.Constraint.IKType.ONE_TWO | The type of IK to use with three layers.
`forceBezier` | `boolean` | <optional> | false | force the use of a bezier IK even with two or three layers
`layers` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | `Layer` | <optional> | DuAEComp.getSelectedLayers() | The layer. If omitted, will use all selected layers in the comp
`controller` | `Layer` | <optional> |  | An already existing controller.
`bezierFK` | `boolean` | <optional> | false | If forceBezier, adds a layer for FK Control

View Source DuAEF_Duik_api.jsxinc, line 40638

Returns:
The controller(s) of the IK.
Type: `Array.<Layer>`

#### # static linkLayersToDropdown(dropdown, layersopt)

Connects a dropdown menu effect to a list of layers, using their opacities.
Note: On After Effects < 17.0.1, the list is not updated to reflect the list of layers.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`dropdown` | `DuAEProperty` | `Property` |  | The dropdown menu property.
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers to control. The selected layers by default.

View Source DuAEF_Duik_api.jsxinc, line 43747

#### # static list()

List

View Source DuAEF_Duik_api.jsxinc, line 39443

#### # static locator(layersopt)

Add Locator

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers

View Source DuAEF_Duik_api.jsxinc, line 42736

#### # static lock(propsopt)

Lock propery values

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`props` | `Property` | `DuAEProperty` | `Array.<Property>` | `Array.<DuAeProperty>` | `DuList.<Property>` | `DuList.<DuAEProperty>` | <optional> | The properties. If omitted, locks the selected properties

View Source DuAEF_Duik_api.jsxinc, line 39704

#### # static morphKeys()

Morph Keys

View Source DuAEF_Duik_api.jsxinc, line 40408

#### # static moveAnchorPoint(location, marginopt, includeMasksopt, layersopt)

Repositions the anchor points of the layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`location` | `DuMath.Location` |  |  | The new location of the anchor points relative to the layer bounds.
`margin` | `float` | <optional> | 0.0 | A margin, in pixels.
`includeMasks` | `Boolean` | <optional> | false | Use masks to compute the bounds.
`layers` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | `Layer` | <optional> | DuAEComp.getSelectedLayers() | The layer. If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39779

#### # static oneLayerIK(layer, goalopt, controlleropt, showGuidesopt) → {Layer}

Creates a one-layer-ik on the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`goal` | `Layer` | `null` | <optional> |  | The goal layer, at the end of the IK
`controller` | `Layer` | `Controller` | `null` | <optional> |  | The layer to use as a controller, can be automatically created. Must be provided if goal is undefined
`showGuides` | `Boolean` | <optional> | true | Set to false to hide guides on the controllers (and improve performance)

View Source DuAEF_Duik_api.jsxinc, line 40702

Returns:
The controller created
Type: `Layer`

#### # static oneTwoLayerIK(layer1, layer2, layer3, goalopt, controlleropt, showGuidesopt) → {Layer}

Creates a 1+2-layer-ik on the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer1` | `Layer` |  |  | The root layer
`layer2` | `Layer` |  |  | The middle layer
`layer3` | `Layer` |  |  | The end layer
`goal` | `Layer` | `null` | <optional> |  | The goal layer, at the end of the IK
`controller` | `Layer` | `null` | <optional> |  | The layer to use as a controller, can be automatically created. Must be provided if goal is undefined
`showGuides` | `Boolean` | <optional> | true | Set to false to hide guides on the controllers (and improve performance)

View Source DuAEF_Duik_api.jsxinc, line 41916

Returns:
The controller created
Type: `Layer`

#### # static orientation(layersopt)

Adds an orientation constraint to the layers

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers

View Source DuAEF_Duik_api.jsxinc, line 43082

#### # static parent(layersopt)

Parent Constraint

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers

View Source DuAEF_Duik_api.jsxinc, line 42590

#### # static parentAcrossComp(parent, useEssentialPropertiesopt, childrenopt)

Parent the layers across compositions to the chosen layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`parent` | `Layer` |  |  | The parent layer
`useEssentialProperties` | `Boolean` | <optional> | true | true to extract using master properties instead of expressions (ignored in Ae < 15.1, false by default if 15.1 <= Ae < 17 and true by default in Ae >= 17)
`children` | `Array.<Layer>` | `DuList.<Layer>` | <optional> |  | The child layers

View Source DuAEF_Duik_api.jsxinc, line 42920

#### # static path(pathopt, layersopt, moveToPathopt) → {Boolean}

Description

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`path` | `PropertyBase` | `DuAEProperty` | <optional> |  | The path, taken from the layer selection if omitted
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> |  | The layers
`moveToPath` | `boolean` | <optional> | false | Set to true to move the layer to the first point on the path

View Source DuAEF_Duik_api.jsxinc, line 43123

Returns:
true if a constraint could be created
Type: `Boolean`

#### # static pin(tangentsopt, propsopt) → {Array.<ShapeLayer>}

Add pins on the properties

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`tangents` | `Boolean` | <optional> | true | Set to false to ignore Bézier path tangents
`props` | `Array.<PropertyBase>` | <optional> |  | The properties to pin

View Source DuAEF_Duik_api.jsxinc, line 43208

Returns:
The pins
Type: `Array.<ShapeLayer>`

#### # static position(layersopt)

Adds a position constraint to the layers

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers

View Source DuAEF_Duik_api.jsxinc, line 43036

#### # static quickConnector(propsopt)

Connects the properties together to a % slider

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`props` | `Array.<Property>` | `Array.<DuAEProperty>` | <optional> | The properties to connect. The selected properties by default.

View Source DuAEF_Duik_api.jsxinc, line 43680

#### # static removeCompInExpressions(selectionModeopt)

Replace all `comp("name")` occurences by `thisComp`.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`selectionMode` | `Duik.SelectionMode` | <optional> | DuAE.SelectionMode.ACTIVE_COMPOSITION | The items where to modify the expressions.

View Source DuAEF_Duik_api.jsxinc, line 43338

#### # static removeLayerInExpressions(selectionModeopt)

Replace all `layer("name")` occurences by `thisLayer`.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`selectionMode` | `Duik.SelectionMode` | <optional> | DuAE.SelectionMode.ACTIVE_COMPOSITION | The items where to modify the expressions.

View Source DuAEF_Duik_api.jsxinc, line 43366

#### # static removeThisCompInExpressions(selectionModeopt)

Replace all `thisComp` occurences by `comp("name")`.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`selectionMode` | `Duik.SelectionMode` | <optional> | DuAE.SelectionMode.ACTIVE_COMPOSITION | The items where to modify the expressions.

View Source DuAEF_Duik_api.jsxinc, line 43324

#### # static removeThisLayerInExpressions(selectionModeopt)

Replace all `thisLayer` occurences by `layer("name")`.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`selectionMode` | `Duik.SelectionMode` | <optional> | DuAE.SelectionMode.ACTIVE_COMPOSITION | The items where to modify the expressions.

View Source DuAEF_Duik_api.jsxinc, line 43352

#### # static resetPRS(layersopt, opacityopt)

Resets the transformation of the selected layers to 0.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | `Layer` | <optional> | DuAEComp.getSelectedLayers() | The layer. If omitted, will use all selected layers in the comp
`opacity` | `Boolean` | <optional> | false | When true, also resets the opacity to 100%

View Source DuAEF_Duik_api.jsxinc, line 39836

#### # static separateDimensions()

Separate Dimensions

View Source DuAEF_Duik_api.jsxinc, line 39529

#### # static separatePropDimensions(prop) → {Array.<DuAEProperty>}

Separates the dimensions of the properties into an effect.
Works with 2D, 3D, and colors

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | `DuAEProperty` | The property

View Source DuAEF_Duik_api.jsxinc, line 39548

Returns:
The seperated properties (or the original one if it could not be separated)
Type: `Array.<DuAEProperty>`

#### # static setupAudioController(audioLayeropt) → {DuAEProperty}

Prepares a visual audio controller to connect to properties

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`audioLayer` | `AVLayer` | <optional> | The layer with the audio to setup. The selected layer by default.

View Source DuAEF_Duik_api.jsxinc, line 43788

Returns:
The value to use with the connector
Type: `DuAEProperty`

#### # static simpleFK(layersopt, controlleropt) → {Layer}

A very simple FK control

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | <optional> | The layers, already parented or ordered from root (at index 0) to end
`controller` | `Layer` | <optional> | An already existing controller.

View Source DuAEF_Duik_api.jsxinc, line 43270

Returns:
The controller of the FK.
Type: `Layer`

#### # static twoLayerIK(layer1, layer2, goalopt, controlleropt, showGuidesopt) → {Layer}

Creates a two-layer-ik on the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer1` | `Layer` |  |  | The root layer
`layer2` | `Layer` |  |  | The end layer
`goal` | `Layer` | `null` | <optional> |  | The goal layer, at the end of the IK
`controller` | `Layer` | `null` | <optional> |  | The layer to use as a controller, can be automatically created. Must be provided if goal is undefined
`showGuides` | `Boolean` | <optional> | true | Set to false to hide guides on the controllers (and improve performance)

View Source DuAEF_Duik_api.jsxinc, line 41083

Returns:
The controller created
Type: `Layer`

#### # static twoOneLayerIK(layer1, layer2, layer3, goalopt, controlleropt, showGuidesopt) → {Layer}

Creates a 1+2-layer-ik on the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer1` | `Layer` |  |  | The root layer
`layer2` | `Layer` |  |  | The middle layer
`layer3` | `Layer` |  |  | The end layer
`goal` | `Layer` | `null` | <optional> |  | The goal layer, at the end of the IK
`controller` | `Layer` | `null` | <optional> |  | The layer to use as a controller, can be automatically created. Must be provided if goal is undefined
`showGuides` | `Boolean` | <optional> | true | Set to false to hide guides on the controllers (and improve performance)

View Source DuAEF_Duik_api.jsxinc, line 41936

Returns:
The controller created
Type: `Layer`

#### # static zero(layersopt) → {Array.<ShapeLayer>}

Zero-out selected layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | `Layer` | <optional> | DuAEComp.getSelectedLayers() | The layer. If omitted, will use all selected layers in the comp

View Source DuAEF_Duik_api.jsxinc, line 39722

Returns:
The zeroes
Type: `Array.<ShapeLayer>`