## DuAELayer

After Effects layer methods

View Source DuAEF_Duik_api.jsxinc, line 28277

# Methods

#### # static addNull(layer) → {Layer}

Adds a new Null object just above a layer, at the same position.
This is a convenience function calling `DuAEComp.addNull`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 29178

Returns:
the null
Type: `Layer`

#### # static addPseudoEffect(layer, preset, matchName, nameopt) → {PropertyGroup|null}

This method is a workaround to AE API method layer.applyPreset to work like addProperty when adding pseudoEffects

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layer` | `Layer` |  | The layer
`preset` | `File` |  | The preset file
`matchName` | `string` |  | The pseudo Effect matchName.
`name` | `string` | <optional> | The name to set on the effect

View Source DuAEF_Duik_api.jsxinc, line 28876

Returns:
The effect or null if anything went wrong
Type: `PropertyGroup` | `null`

#### # static align(layers, target, positionopt, rotationopt, scaleopt, opacityopt)

Aligns the layers' transformations (position, rotation, scale) to another layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` |  |  | The layers to align.
`target` | `Layer` |  |  | The reference layer.
`position` | `boolean` | <optional> | true | True to align position.
`rotation` | `boolean` | <optional> | true | True to align orientation.
`scale` | `boolean` | <optional> | true | True to align scale.
`opacity` | `boolean` | <optional> | false | True to align opcacity.

View Source DuAEF_Duik_api.jsxinc, line 29402

#### # static alignOpacity(layer, target)

Aligns a layer's opcaity to another layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to align.
`target` | `Layer` | The reference layer.

View Source DuAEF_Duik_api.jsxinc, line 29385

#### # static alignOrientation(layer, target)

Aligns a layer's orientation to another layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to align.
`target` | `Layer` | The reference layer.

View Source DuAEF_Duik_api.jsxinc, line 29341

#### # static alignPosition(layer, target)

Aligns a layer in position to another layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to align.
`target` | `Layer` | The reference layer.

View Source DuAEF_Duik_api.jsxinc, line 29318

#### # static alignScale(layer, target)

Aligns a layer's scale to another layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to align.
`target` | `Layer` | The reference layer.

View Source DuAEF_Duik_api.jsxinc, line 29363

#### # static angleFromLayers(angleLayer, oppositeLayerA, oppositeLayerB) → {float}

Finds the angle formed by three layers

##### Parameters:

Name | Type | Description
--- | --- | ---
`angleLayer` | `Layer` | The layer at which to measure the angle
`oppositeLayerA` | `Layer` | One of the opposite layers
`oppositeLayerB` | `Layer` | The other opposite layer

View Source DuAEF_Duik_api.jsxinc, line 30196

Returns:
The angle in degrees.
Type: `float`

#### # static applyPreset(layer, preset, matchName) → {PropertyGroup|null}

Adds an animation preset on the layer.
Be careful as layer selection will be kept but not properties selection,
and this can result in an "invalid object" if referencing a property.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer
`preset` | `File` | The preset file
`matchName` | `string` | The pseudo Effect matchName

View Source DuAEF_Duik_api.jsxinc, line 28839

Returns:
The effect corresponding matchName or null if anything went wrong
Type: `PropertyGroup` | `null`

#### # static autoDuration(layer, preExpressionopt)

Sets the In and Out points of a layer according to its opacity (cuts at 0%)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`preExpression` | `boolean` | <optional> | false | Whether to check for the opacity post or pre-expression value

View Source DuAEF_Duik_api.jsxinc, line 29512

#### # static bake(layer, modeopt, frameStepopt)

Bakes the expressions to keyframes and removes all non-renderable layers.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer to bake.
`mode` | `DuAEExpression.BakeAlgorithm` | <optional> | DuAEExpression.BakeAlgorithm.SMART | The algorithm to use for baking the expressions.
`frameStep` | `float` | <optional> | 1.0 | By default, checks one value per keyframe. A lower value increases the precision and allows for sub-frame sampling. A higher value is faster but less precise.

View Source DuAEF_Duik_api.jsxinc, line 29999

#### # static copyToComp(layers, destinationComp, withPropertyLinksopt) → {Array.<Layer>}

Copies the layers to another comp

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` |  |  | The layers to copy and paste
`destinationComp` | `CompItem` |  |  | The composition to copy to
`withPropertyLinks` | `boolean` | <optional> | false | Add expressions on the properties to link them to the orriginal layers Works only on 12.0 and above, ignored on 11.0 (CS6) and below

View Source DuAEF_Duik_api.jsxinc, line 29198

Returns:
The new layers
Type: `Array.<Layer>`

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

Returns:
The locator
Type: `ShapeLayer`

#### # static doLayers(method, undoGroupNameopt)

Runs a function on all the layers

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`method` | `function` |  | The function to run on the layers, which takes a layer as its only argument.
`undoGroupName` | `string` | <optional> | The name of the undoGroup created before the execution. If not provided, there will not be any undoGroup created.

View Source DuAEF_Duik_api.jsxinc, line 28359

#### # static expressionLink(layer, useThisCompopt) → {str}

Gets an expression linking to the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`useThisComp` | `Boolean` | <optional> | false | Whether to begin the expression by 'thisComp' or 'comp("name")'

View Source DuAEF_Duik_api.jsxinc, line 29563

Returns:
The expression link to the layer
Type: `str`

#### # static firstKeyFrameTime(layer, selected) → {float|null}

Gets the time of the first keyFrame

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Array.<Layer>` | `LayerCollection` | The layer
`selected` | `boolean` | true to check selected keyframes only

View Source DuAEF_Duik_api.jsxinc, line 28941

Returns:
The keyframe time or null if there are no keyframe
Type: `float` | `null`

#### # static getActiveProperty(layer) → {DuAEProperty|null}

Gets the After Effects active property (the last selected one)

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 28466

Returns:
The selected property, or null if there isn't any.
Type: `DuAEProperty` | `null`

#### # static getAnim(layer, selectedopt, timeRangeopt) → {DuAELayerAnimation}

Gets all animations on the layer in the whole timeline or in the time range
The first DuAEKeyframe._time will be adjusted relatively to the start of the time range (if provided) instead of the startTime of the composition.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer.
`selected` | `Boolean` | <optional> | false | true to get only selected keyframes.
`timeRange` | `Array.<float>` | <optional> |  | The time range, an array of two time values, in seconds.

View Source DuAEF_Duik_api.jsxinc, line 28481

Returns:
The animation.
Type: `DuAELayerAnimation`

#### # static getAnims(layers, selectedopt, timeRangeopt) → {Array.<DuAELayerAnimation>}

Gets all animations on the layers in the whole timeline or in the time range
The first DuAEKeyframe._time will be adjusted relatively to the start of the time range (if provided) instead of the startTime of the composition.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` |  |  | The layers.
`selected` | `Boolean` | <optional> | false | true to get only selected keyframes.
`timeRange` | `Array.<float>` | <optional> |  | The time range, an array of two time values, in seconds.

View Source DuAEF_Duik_api.jsxinc, line 28512

Returns:
The animations.
Type: `Array.<DuAELayerAnimation>`

#### # static getChildren(layer) → {Array.<Layer>}

Gets the children of a layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer.

View Source DuAEF_Duik_api.jsxinc, line 28692

Returns:
All the children of the layer
Type: `Array.<Layer>`

#### # static getCreateLayerEffect(layer, targetLayer, effectNameopt) → {DuAEProperty|null}

Gets or create a layer control effect targetting the given target layer.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layer` | `Layer` |  | The layer to get the effect from
`targetLayer` | `Layer` |  | The targetted layer, which must be in the same comp than the layer.
`effectName` | `string` | <optional> | The name to use when creating the effect.

View Source DuAEF_Duik_api.jsxinc, line 29840

Returns:
The effect or null if the two layers are not in the same comp.
Type: `DuAEProperty` | `null`

#### # static getDistance(layer1opt, layer2opt) → {float}

Measures the distance between two layers

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layer1` | `Layer` | <optional> | The first layer. If omitted, will use the selected layers in the current comp
`layer2` | `Layer` | <optional> | The second layer

View Source DuAEF_Duik_api.jsxinc, line 28758

Returns:
The distance (in pixels). -1 if less than two layers are found
Type: `float`

#### # static getMaxDistance(layers) → {float}

Gets the maximum distance between a bunch of layers

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 28779

Returns:
The distance (in pixels)
Type: `float`

#### # static getPuppetPins(layer) → {Array.<DuAEProperty>}

Gets all the (selected) puppet pins found on the layer.
Will return all puppet pins if there is no puppet selection.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 29275

Returns:
The properties
Type: `Array.<DuAEProperty>`

#### # static getRelation(layer1, layer2) → {int|null}

Checks if a layer is a descendant of another layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer1` | `Layer` | The first layer
`layer2` | `Layer` | The second layer

View Source DuAEF_Duik_api.jsxinc, line 28728

Returns:
the degree of relation. 0 if layer1 is not a relative of layer2,
negative if layer2 is a descendant of layer1, positive if layer2 is an ancestor.
null if the two layers are not in the same composition or if they are the same layer.
Type: `int` | `null`

#### # static getSelectedProps(layer, filteropt, strictopt, caseSensitiveopt) → {Array.<DuAEProperty>}

Gets the After Effects selected properties in the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`filter` | `PropertyType` | `PropertyValueType` | `string` | `function` | <optional> |  | A filter to get only a certain type, or value type, or property name or matchName. A function which take one PropertyBase as argument can be used to filter the properties: the Property will be returned if the function returns true.
`strict` | `boolean` | <optional> | false | If a string filter is provided, whether to search for the exact name/matchName or if it contains the filter.
`caseSensitive` | `boolean` | <optional> | true | If a string filter is provided, and not strict is false, does the search have to be case sensitive?

View Source DuAEF_Duik_api.jsxinc, line 28417

Returns:
The selected properties, an empty Array if nothing active or selected
Type: `Array.<DuAEProperty>`

#### # static getTransformMatrix(layer, timeopt) → {Matrix}

Gets the transformation matrix of the layer from the compostion.
Use Matrix.applyToPoint(point) to transform any coordinate with the matrix returned by this method.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layer` | `Array.<Layer>` |  | the layer
`time` | `float` | <optional> | the time at which to get the coordinates. Current time by default.

View Source DuAEF_Duik_api.jsxinc, line 29433

Returns:
The coordinates.
Type: `Matrix`

#### # static getWorldPos(layer, pointopt, timeopt) → {Array.<float>}

Gets the world coordinates of the point of a layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`point` | `Array.<float>` | <optional> | layer.transform.anchorPoint.value | the point
`time` | `float` | <optional> |  | the time at which to get the coordinates. Current time by default.

View Source DuAEF_Duik_api.jsxinc, line 28799

Returns:
The world coordinates of the layer
Type: `Array.<float>`

#### # static hasChild(layer) → {Boolean}

Checks if a layer has at least one child.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to test

View Source DuAEF_Duik_api.jsxinc, line 28709

Returns:
true if the layer has at least one child.
Type: `Boolean`

#### # static hasExpressions(layer) → {Boolean}

Checks if the layer has some expressions

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 30157

Returns:
Type: `Boolean`

#### # static hasKeys(layer) → {Boolean}

Checks if the layer has some keyframes

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 30147

Returns:
Type: `Boolean`

#### # static hasMask(layer) → {Boolean}

Checks if the layer has some masks

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 30167

Returns:
Type: `Boolean`

#### # static haveSelectedKeys(layers) → {boolean}

Checks if the layers have some selected keyframes

##### Parameters:

Name | Type | Description
--- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` | The layers

View Source DuAEF_Duik_api.jsxinc, line 28925

Returns:
true if the layers have at least one selected keyframe
Type: `boolean`

#### # static height(layer) → {Number}

Gets the actual height of a layer (including it's scale)

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `AVLayer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 30075

Returns:
The height, in pixels.
Type: `Number`

#### # static insideComp(layer, useBoundsopt) → {Boolean}

Checks if the layer is inside the bounds of the composition

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | the layer to check
`useBounds` | `Boolean` | <optional> | false | (not implemented yet) Checks the layer bounds if true, just the anchor point if false.

View Source DuAEF_Duik_api.jsxinc, line 29616

Returns:
true if the layer is inside the composition
Type: `Boolean`

#### # static isComp(layer) → {Boolean}

Checks if the given layer is a precomposition.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to test

View Source DuAEF_Duik_api.jsxinc, line 29600

Returns:
true if it is a composition
Type: `Boolean`

#### # static isNull(layer) → {bool}

Checks if this is a null layer, either a true AE Null layer, or a "Shape as Null" as created by DuAEF with `DuAEComp.addNull`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to test

View Source DuAEF_Duik_api.jsxinc, line 30177

Returns:
Type: `bool`

#### # static isRenderable() → {Bool}

Checks if a layer is renderable. A non-renderable layer can be:

- A Null layer
- A Guide layer
- An empty shape layer
- An empty text layer
- A layer with the opacity at 0% for the whole composition

View Source DuAEF_Duik_api.jsxinc, line 29968

Returns:
Type: `Bool`

#### # static isSolid(layer) → {Boolean}

Checks if the given layer is a solid.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to test

View Source DuAEF_Duik_api.jsxinc, line 29583

Returns:
true if it is a solid
Type: `Boolean`

#### # static isThreeD(layer) → {bool}

Checks if a layer is 3D (ie is a threeDLayer or a camera or a light)

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 29550

Returns:
true if the layer is a 3D layer
Type: `bool`

#### # static isType(layer, layerType) → {Boolean}

Checks if the layer is one of the types created by duaef.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to check
`layerType` | `Duik.Layer.Type` | The type of layer

View Source DuAEF_Duik_api.jsxinc, line 28304

Returns:
Type: `Boolean`

#### # static isTypePrefix(prefix) → {bool}

Checks if a string is one of the prefixes used to identify layer types in their names

##### Parameters:

Name | Type | Description
--- | --- | ---
`prefix` | `string` | The string to check

View Source DuAEF_Duik_api.jsxinc, line 28291

Returns:
True if the string is one of the predefined prefixes.
Type: `bool`

#### # static lastEffect(layer, nameopt, skipopt) → {PropertyGroup|null}

Gets the last corresponding effect (instead of the first with the native layer.effect() method)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`name` | `string` | <optional> |  | The name or matchname to look for. If omitted, will return the last effect.
`skip` | `int` | <optional> | 0 | Number of effects to skip

View Source DuAEF_Duik_api.jsxinc, line 29647

Returns:
The effect or null if not found.
Type: `PropertyGroup` | `null`

#### # static lockScale(layer)

Locks the scale with an expression so its value cannot be changed

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 29186

#### # static moveInsideComp(layer, useBoundsopt)

Moves a layer in the center of the comp if it is outside

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | the layer to check
`useBounds` | `Boolean` | <optional> | false | (not implemented yet) Checks the layer bounds if true, just the anchor point if false.

View Source DuAEF_Duik_api.jsxinc, line 29631

#### # static moveLayerToProperty(layer, prop)

Moves a layer to the coordinates of a spatial property

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 29480

#### # static newUniqueEffectName(newName, layer, incrementopt) → {string}

Generates a new unique name for an effect

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`newName` | `string` |  |  | The wanted new name
`layer` | `Layer` |  |  | The layer
`increment` | `boolean` | <optional> | true | true to automatically increment the new name if it already ends with a digit

View Source DuAEF_Duik_api.jsxinc, line 28374

Returns:
The unique name, with a new number at the end if needed.
Type: `string`

#### # static newUniqueMarkerName(newName, layer, incrementopt) → {string}

Generates a new unique name for a marker for this layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`newName` | `string` |  |  | The wanted new name
`layer` | `Layer` |  |  | The layer
`increment` | `boolean` | <optional> | true | true to automatically increment the new name if it already ends with a digit

View Source DuAEF_Duik_api.jsxinc, line 28399

Returns:
The unique name, with a new number at the end if needed.
Type: `string`

#### # static parent(layers, parentopt, unparentedOnlyopt, insertopt)

Parents all (unparented) layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Layer` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` |  |  | The layers to parent
`parent` | `Layer` | <optional> |  | The parent. If not defined, will use the last layer of the list
`unparentedOnly` | `boolean` | <optional> | true | True to parent only layers which do not have a parent yet
`insert` | `boolean` | <optional> | false | When true, the parent will be parented to the previous parent of the given layer (or first layer if the layers param is a list)

View Source DuAEF_Duik_api.jsxinc, line 29247

#### # static parentChain(layers)

Parents all the layers together beginning by the end of the array

##### Parameters:

Name | Type | Description
--- | --- | ---
`layers` | `Array.<Layer>` | `DuList.<Layer>` | The layers to parent

View Source DuAEF_Duik_api.jsxinc, line 29032

#### # static repositionAnchorPoint(layer, value)

Changes the coordinates of the anchor point without moving the layer

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer
`value` | `Array.<float>` | The new coordinates

View Source DuAEF_Duik_api.jsxinc, line 29666

#### # static reverseAnims(anims)

Reverses the times of the keyframes to reverse the animation

##### Parameters:

Name | Type | Description
--- | --- | ---
`anims` | `Array.<DuAELayerAnimation>` | `DuAELayerAnimation` | The animation

View Source DuAEF_Duik_api.jsxinc, line 28646

#### # static sequence(layersopt, expropt)

Creates a sequence with the layers, but using opacities. This enables more possibilities to rig them, like with the Duik Connector

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` | <optional> | The layers. The selected layers by default.
`expr` | `string` | <optional> | An expression to add to the opacity of the layers

View Source DuAEF_Duik_api.jsxinc, line 29148

#### # static setAllAnims(layers, anims, timeopt, ignoreNameopt, setExpressionopt, onlyKeyframesopt, replaceopt, whiteListopt, offsetopt, reverseopt)

Sets the animations on the layers.
If you need to set only on the same layers (same index, same name), use `DuAELayer.setAnims`.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` |  |  | The layers. If there are more layers than animations, the layers array will be truncated.
`anims` | `Array.<DuAELayerAnimation>` |  |  | The layer animations. If there are more animations than layers, the animations array will be truncated.
`time` | `float` | <optional> | comp.time | The time where to begin the animation
`ignoreName` | `Boolean` | <optional> | false | true to set the anim even if name of the property do not match the name animation. This way, only the type of property (i.e. matchName) is checked.
`setExpression` | `Boolean` | <optional> | false | Set the expression on the property
`onlyKeyframes` | `Boolean` | <optional> | true | If false, the value of properties without keyframes will be set too.
`replace` | `Boolean` | <optional> | false | true to remove any existing keyframe on the properties before adding new keyframes
`whiteList` | `Array.<string>` | <optional> |  | A list of matchNames used as a white list for properties to set anims. Can be the matchName of a propertyGroup to set all the subproperties.
`offset` | `Boolean` | <optional> | false | true to offset the current value, instead of replacing it
`reverse` | `Boolean` | <optional> | false | true to reverse the keyframes (in time) Note: the remaining animations which are returned will already be reversed, do not set this to true again if you plan to set them later.

View Source DuAEF_Duik_api.jsxinc, line 28584

#### # static setAnim(layer, anims, timeopt, ignoreNameopt, setExpressionopt, onlyKeyframesopt, replaceopt, propertyWhiteListopt, offsetopt, reverseopt, dontMoveAncestorsopt) → {Boolean}

Sets the property animation on the property

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer.
`anims` | `DuAELayerAnimation` |  |  | The animation
`time` | `float` | <optional> | comp.time | The time where to begin the animation
`ignoreName` | `Boolean` | <optional> | false | true to set the anim even if name of the property do not match the name of the animation. This way, only the type of property (i.e. matchName) is checked.
`setExpression` | `Boolean` | <optional> | false | Set the expression on the property
`onlyKeyframes` | `Boolean` | <optional> | true | If false, the value of properties without keyframes will be set too.
`replace` | `Boolean` | <optional> | false | true to remove any existing keyframe on the properties before adding new keyframes
`propertyWhiteList` | `Array.<string>` | <optional> |  | A list of matchNames used as a white list for properties to set anims. Can be the matchName of a propertyGroup to set all the subproperties.
`offset` | `Boolean` | <optional> | false | true to offset the current value, instead of replacing it
`reverse` | `Boolean` | <optional> | false | true to reverse the keyframes (in time)
`dontMoveAncestors` | `Boolean` | <optional> | false | When set to true, the transform (position, rotation) values for ancestor layers (the ones without parent) will be offset to 0 before applying the animation.

View Source DuAEF_Duik_api.jsxinc, line 28537

Returns:
true if the anim was actually set.
Type: `Boolean`

#### # static setAnims(layers, anims, timeopt, ignoreNameopt, setExpressionopt, onlyKeyframesopt, replaceopt, whiteListopt, offsetopt, reverseopt, dontMoveAncestorsopt) → {Array.<DuAELayerAnimation>}

Sets the animations on the corresponding layers.
The animation will be set only on layers with the same name and index.
To set all animations on all layers, not checking their names or indices, use `DuAELayer.setAllAnims`.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` |  |  | The layers.
`anims` | `Array.<DuAELayerAnimation>` |  |  | The layer animations
`time` | `float` | <optional> | comp.time | The time where to begin the animation
`ignoreName` | `Boolean` | <optional> | false | true to set the anim even if name of the property do not match the name animation. This way, only the type of property (i.e. matchName) is checked.
`setExpression` | `Boolean` | <optional> | false | Set the expression on the property
`onlyKeyframes` | `Boolean` | <optional> | true | If false, the value of properties without keyframes will be set too.
`replace` | `Boolean` | <optional> | false | true to remove any existing keyframe on the properties before adding new keyframes
`whiteList` | `Array.<string>` | <optional> |  | A list of matchNames used as a white list for properties to set anims. Can be the matchName of a propertyGroup to set all the subproperties.
`offset` | `Boolean` | <optional> | false | true to offset the current value, instead of replacing it
`reverse` | `Boolean` | <optional> | false | true to reverse the keyframes (in time) Note: the remaining animations which are returned will already be reversed, do not set this to true again if you plan to set them later.
`dontMoveAncestors` | `Boolean` | <optional> | false | When set to true, the transform (position, rotation) values for ancestor layers (the ones without parent) will be offset to 0 before applying the animation.

View Source DuAEF_Duik_api.jsxinc, line 28616

Returns:
The animations which were not set (no corresponding layers)
Type: `Array.<DuAELayerAnimation>`

#### # static setPosition(layer, position, worldopt)

Sets the new coordinates of the layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer to move
`position` | `Array.<float>` |  |  | The new coordinates
`world` | `boolean` | <optional> | false | Set to true to use world coordinates.

View Source DuAEF_Duik_api.jsxinc, line 30126

#### # static setType(type, layersopt)

Sets the type of the layer

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | `Duik.Layer.Type` |  |  | The type
`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 28326

#### # static sortByIndex(layers) → {Array.<Layer>}

Sort the layers by their indices. Returns a new Array, the original array or collection is not changed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layers` | `Array.<Layer>` | `LayerCollection` | `DuList.<Layer>` | The layers to sort

View Source DuAEF_Duik_api.jsxinc, line 29018

Returns:
The sorted array
Type: `Array.<Layer>`

#### # static sortByParent(layers) → {Array.<Layer>}

Sort the layers by their parenting (root at first index 0)

##### Parameters:

Name | Type | Description
--- | --- | ---
`layers` | `Array.<Layer>` | `Collection` | `DuList.<Layer>` | The layers to sort

View Source DuAEF_Duik_api.jsxinc, line 28963

Returns:
The sorted array
Type: `Array.<Layer>`

#### # static sourceRect(layer, timeopt, includeExtentsopt, includeMasksopt) → {Array.<float>}

Returns the bounds of the layer in local coordinates, like the sourceRectAtTime() function does in expressions, but can also include masks.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer
`time` | `float` | <optional> |  | The time at which to get the bounds, the current time by default
`includeExtents` | `Boolean` | <optional> | true | Includes the extents (strokes, accents...)
`includeMasks` | `Boolean` | <optional> | true | Includes the masks

View Source DuAEF_Duik_api.jsxinc, line 29783

Returns:
The bounds [top, left, width, height]
Type: `Array.<float>`

#### # static stack(layers)

Stacks the layers in the timeline according to their order in the given array/DuList

##### Parameters:

Name | Type | Description
--- | --- | ---
`layers` | `LayerCollection` | `Array.<Layer>` | `DuList.<Layer>` | The layers to stack

View Source DuAEF_Duik_api.jsxinc, line 30093

#### # static toggleEditMode(layer)

(Un)parent the children of the layer.< br/> When children are unparented, an effect is added and the name of the layer is changed to show the "edit mode" is enabled.
When toggled again, the effect is removed, and the name is restored.

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `Layer` | The layer to toggle.

View Source DuAEF_Duik_api.jsxinc, line 29066

#### # static translate(layer, offset, worldopt)

Sets the new coordinates of the layer to translate it by offset.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layer` | `Layer` |  |  | The layer to move
`offset` | `Array.<float>` |  |  | The value of the translation. A two or three dimensionnal array.
`world` | `boolean` | <optional> | false | Set to true to offset in world coordinates.

View Source DuAEF_Duik_api.jsxinc, line 30107

#### # static type(layeropt) → {Duik.Layer.Type}

Gets the type of the layer

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`layer` | `Layer` | <optional> | The layer. If omitted, will check the first selected bone of the current comp

View Source DuAEF_Duik_api.jsxinc, line 28313

Returns:
The type
Type: `Duik.Layer.Type`

#### # static unparent(layers)

Un-parents all the layers

##### Parameters:

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

View Source DuAEF_Duik_api.jsxinc, line 29054

#### # static width(layer) → {Number}

Gets the actual width of a layer (including it's scale)

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | `AVLayer` | The layer

View Source DuAEF_Duik_api.jsxinc, line 30056

Returns:
The width, in pixels.
Type: `Number`