## DuAEExpression.Library

The expression library
Use `DuAEExpression.Library.get` and `DuAEExpression.Library.getRequirements`
to easily include the methods and classes listed here to your expressions.
These methods take the name (listed here) of the function/class as arguments.

View Source Duik_api_fordoc.jsxinc, line 25092

### Classes

"FuzzyLogic"
"FuzzyVeracity"
"Matrix"

# Methods

#### # static "addNoise"(val, quantity)

Adds some noise to a value.
You may use seedRandom() before using this function as it will influence the generated noise. A timeless noise can be achieved with `seedRandom(index,true)` for example.

##### Parameters:

Name | Type | Description
--- | --- | ---
`val` | `number` | `Array.<number>` | The value to add noise to.
`quantity` | `float` | The quantity of noise. A percentage. 100 means the value can range from (val * 0) to (val * 2).

View Source Duik_api_fordoc.jsxinc, line 27443

##### Examples

    seedRandom(index, true) // a timeless noise
    addNoise(value, 50 ); // the property value will have noise between (value * 0.5) and (value * 1.5) which won't vary through time.

    seedRandom(index, false);
    addNoise(value, 33 ); // the noise will change at each frame, varying between (value * .66) and (value * 1.33)

#### # static "addPath"(path1, path2, path2weight) → {Object}

Adds two paths together.
The paths must be objects with three array attributes: points, inTangents, outTangents

##### Parameters:

Name | Type | Description
--- | --- | ---
`path1` | `Object` | First path
`path2` | `Object` | Second path
`path2weight` | `float` | A weight to multiply the second path values

View Source Duik_api_fordoc.jsxinc, line 27000

Requires:

- module:addPoints

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "addPoints"(p1, p2, w) → {Array.<Array.<float>>}

Adds two lists of points/vectors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | `Array.<Array.<float>>` | The list of points
`p2` | `Array.<Array.<float>>` | The other list of points
`w` | `float` | A weight to multiply the values of p2

View Source Duik_api_fordoc.jsxinc, line 26661

Returns:
The added points
Type: `Array.<Array.<float>>`

#### # static "animate"(keyframes, loopOutopt, loopInopt, timeopt) → {number}

Animates the property using the given keyframes

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`keyframes` | `Array.<Object>` |  |  | The keyframes. An object with four properties: `value` The value of the keyframe `time` The time of the keyframe `interpolation` (optional. Default: linear) A function taking 5 arguments to interpolate between this keyframe and the next one `params` (optional.) A sixth argument passed to the interpolation function. To be used with DuAEF interpolations. Note that the keyframes must be sorted. The function does not sort them, as it would have a bad impact on performance.
`loopOut` | `string` | <optional> | 'none' | One of 'none', 'cycle', 'pingpong'.
`loopIn` | `string` | <optional> | 'none' | One of 'none', 'cycle', 'pingpong'.
`time` | `float` | <optional> | time | Use this to control how time flows.

View Source Duik_api_fordoc.jsxinc, line 25772

Returns:
the animated value.
Type: `number`

##### Example

    var keyframes = [
       {value: 0, time: 1, interpolation: linear},
       {value: 180, time: 2, interpolation: gaussianInterpolation, params: -0.5}, //You need to include the gaussianInterpolation function from DuAEF
       {value: 250, time: 4, interpolation: ease},
       {value: 360, time: 5},
    ];
    animate(keyframes, 'cycle', 'pingpong');

#### # static "bezierInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, bezierPointsopt) → {number}

Interpolates a value with a bezier curve.
This method can replace `linear()` and `ease()` with a custom bézier interpolation.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`bezierPoints` | `Array.<number>` | <optional> | [0.33,0.0,0.66,1.0] | an Array of 4 coordinates wihtin the [0.0, 1.0] range which describes the Bézier interpolation. The default mimics the native ease() function [ outTangentX, outTangentY, inTangentX, inTangentY ]

View Source Duik_api_fordoc.jsxinc, line 25834

Returns:
the value.
Type: `number`

#### # static "blendColor"(colorA, colorB, opacityopt, blendlingModeopt) → {Array.<float>}

Blends two colors together

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`colorA` | `Array.<float>` |  |  | The first color
`colorB` | `Array.<float>` |  |  | The second color
`opacity` | `float` | <optional> |  | The opacity of the second color, overrides colorB[3].
`blendlingMode` | `int` | <optional> | 0 | The blending mode, one of: 0: Normal 1: Add 2: Lighter color 3: Multiply 4: Darker color

View Source Duik_api_fordoc.jsxinc, line 25199

Requires:

- module:blendColorValue

Returns:
The new color
Type: `Array.<float>`

#### # static "blendColorValue"(colorA, colorB, opacityopt, blendlingModeopt) → {float}

Blends two colors together

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`colorA` | `float` |  |  | The first color
`colorB` | `float` |  |  | The second color
`opacity` | `float` | <optional> | 1 | The opacity
`blendlingMode` | `int` | <optional> | 0 | The blending mode, one of: 0: Normal 1: Add 3: Multiply

View Source Duik_api_fordoc.jsxinc, line 25239

Returns:
The new value
Type: `float`

#### # static "bounce"(t, elasticity, damping, vAtTimeopt) → {float|Array.<float>}

Bounce, to be used when the speed is 0.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`elasticity` | `float` |  |  | The elasticity, which controls the amplitude and frequence according to the last known velocity
`damping` | `float` |  |  | Damping
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.

View Source Duik_api_fordoc.jsxinc, line 26351

Requires:

- module:getPrevKey
- module:bezierInterpolation

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "checkDuikEffect"(fx, duikMatchName) → {boolean}

Checks the type of a pseudo-effect used by Duik.
This is a workaround for the missing matchName in expressions.
Pseudo-Effects used by Duik start with a hidden property which name is the same as the matchName of the effect itself (without the 'Pseudo/' part).

##### Parameters:

Name | Type | Description
--- | --- | ---
`fx` | `Property` | The effect to check
`duikMatchName` | `string` | The matchName of a pseudo-effect used by Duik (without the 'Pseudo/' part)

View Source Duik_api_fordoc.jsxinc, line 27113

Returns:
True when the property at propIndex is named propName
Type: `boolean`

##### Example

    if ( checkEffect(thisLayer.effect(1), "DUIK parentConstraint2") ) { "This is the second version of the parent constraint by Duik" }
    else { "Who knows what this is?" }

#### # static "checkEffect"(fx, propIndex, propName) → {boolean}

Checks the type of an effect.
This is a workaround for the missing matchName in expressions.
It checks if the given effect has a specific property at a specific index.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fx` | `Property` | The effect to check
`propIndex` | `int` | The index of the property
`propName` | `string` | The expected name of the property. Be careful with the internationalization of After Effects...

View Source Duik_api_fordoc.jsxinc, line 27137

Returns:
True when the property at propIndex is named propName
Type: `boolean`

##### Example

    if ( checkEffect(thisLayer.effect(1), 1, "Blur") ) { "The first effect is a blur!" }
    else { "Who knows what this is?" }

#### # static "continueIn"(t, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopIn('continue').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all previous frames.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26415

Requires:

- module:getNextKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "continueOut"(t, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopOut('continue').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26437

Requires:

- module:getNextKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "cycleIn"(t, nK, o, vAtTimeopt, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopIn('cycle') and loopIn('offset').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all previous frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`o` | `Boolean` |  |  | Wether to offset or cycle
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26462

Requires:

- module:getNextKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "cycleOut"(t, nK, o, vAtTimeopt, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopOut('cycle') and loopOut('offset').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`o` | `Boolean` |  |  | Wether to offset or cycle
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26503

Requires:

- module:getPrevKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "dishineritRotation"(lopt) → {float}

Removes the ancestors rotation from the rotation of a layer. This is very useful to make a layer keep its orientation without being influenced by its parents.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27471

Requires:

- module:sign

Returns:
The new rotation value, in degrees.
Type: `float`

##### Examples

    //in a rotation property, just include the function and use:
    dishineritRotation();
    //the layer will now keep its own orientation.

    //you can also combine the result with something else
    var result = dishineritRotation();
    result + wiggle(5,20);

#### # static "dishineritScale"(lopt) → {Array.<float>}

Removes the ancestors scale from the scale of a layer. This is very useful to make a layer keep its scale without being influenced by its parents.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27503

Returns:
The new scale value, in percent.
Type: `Array.<float>`

##### Examples

    //in a rotation property, just include the function and use:
    dishineritScale();
    //the layer will now keep its own scale.

    //you can also combine the result with something else
    var result = dishineritScale();
    result + wiggle(5,20);

#### # static "distanceToLine"(point, line) → {float}

Gets the distance of a point to a line

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<float>` | The point [x,y]
`line` | `Array.<Array.<float>>` | The line [ A , B ] where A and B are two points

View Source Duik_api_fordoc.jsxinc, line 26709

Returns:
The distance
Type: `float`

#### # static "expInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}

Interpolates a value with an exponential function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 1 | The raising speed in the range [0, inf].

View Source Duik_api_fordoc.jsxinc, line 25882

Requires:

- module:linearExtrapolation

Returns:
the value.
Type: `number`

#### # static "fromGroupToLayer"(point) → {Array.<number>}

Converts the point coordinates from the current group in the shape layer to the Layer.
Use toWorld and toComp with the result if you need te coordinates in the world or the comp.

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<number>` | The 2D coordinates of the point in the current group.

View Source Duik_api_fordoc.jsxinc, line 27535

Requires:

- module:Matrix
- module:getGroupTransformMatrix

Returns:
The 2D coordinates of the point in the Layer.
Type: `Array.<number>`

#### # static "fromLayerToGroup"(point) → {Array.<number>}

Converts the point coordinates from Layer to the current group in the shape layer.
Use fromWorld or fromComp first if you need to convert from the world or composition coordinates, and pass the result to this function.

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<number>` | The 2D coordinates of the point in the Layer.

View Source Duik_api_fordoc.jsxinc, line 27553

Requires:

- module:Matrix
- module:getGroupTransformMatrix

Returns:
The 2D coordinates of the point in the current group.
Type: `Array.<number>`

#### # static "gaussian"(value, minopt, maxopt, centeropt, fwhmopt) → {Number}

The gaussian function

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | `Number` |  |  | The variable
`min` | `Number` | <optional> | 0 | The minimum return value
`max` | `Number` | <optional> | 1 | The maximum return value
`center` | `Number` | <optional> | 0 | The center of the peak
`fwhm` | `Number` | <optional> | 1 | The full width at half maximum of the curve

View Source Duik_api_fordoc.jsxinc, line 26735

Returns:
The result
Type: `Number`

#### # static "gaussianInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}

Interpolates a value with a gaussian function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 0 | The raising speed in the range [-1.0, 1.0].

View Source Duik_api_fordoc.jsxinc, line 25914

Returns:
the value.
Type: `number`

#### # static "gaussianRateToBezierPoints"(rate) → {number}

Converts a Gaussian rate (as used with `gaussianInterpolation`) to the closest possible Bézier controls for use with `bezierInterpolation`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`rate` | `number` | The raising speed in the range [-1.0, 1.0].

View Source Duik_api_fordoc.jsxinc, line 25953

Returns:
the value.
Type: `number`

#### # static "getCompScale"(lopt, topt) → {number}

Gets the "real" scale of a layer, resulting to its scale property, the scale of its parents, and it's location in Z-space if it's 3D.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer
`t` | `number` | <optional> | time | The time when to get the scale

View Source Duik_api_fordoc.jsxinc, line 27570

Returns:
The scale ratio. This is not a percent, 1.0 is 100%.
Type: `number`

#### # static "getEffectLayer"(fx, ind) → {Layer|null}

Gets a layer from a layer property in an effect, without generating an error if "None" is selected with the Legacy expression engine.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fx` | `Property` | The effect
`ind` | `int` | `string` | The index or the name of the property

View Source Duik_api_fordoc.jsxinc, line 27160

Returns:
The layer, or null if set to "None"
Type: `Layer` | `null`

#### # static "getGroupTransformMatrix"(propopt) → {Matrix}

Gets the transformation Matrix for the current group in a shape layer, including the transformation from the ancestor groups
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property from which to get the matrix

View Source Duik_api_fordoc.jsxinc, line 27591

Requires:

- module:isLayer
- module:Matrix

Returns:
The 2D Transform Matrix.
Type: `Matrix`

#### # static "getLayerCompPos"(topt, lopt) → {Array.<number>}

Gets the comp position (2D Projection in the comp) of a layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27625

Returns:
The comp position
Type: `Array.<number>`

#### # static "getLayerDistance"(other, originopt, topt) → {Array.<number>}

Gets the world position of a layer.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`other` | `Layer` |  |  | The other layer
`origin` | `Layer` | <optional> | thisLayer | The origin
`t` | `number` | <optional> | time | Time from when to get the position

View Source Duik_api_fordoc.jsxinc, line 27646

Requires:

- module:getLayerWorldPos

Returns:
The world position
Type: `Array.<number>`

#### # static "getLayerWorldPos"(topt, lopt) → {Array.<number>}

Gets the world position of a layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27665

Returns:
The world position
Type: `Array.<number>`

#### # static "getLayerWorldSpeed"(topt, lopt) → {number}

Gets the world instant speed of a layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The time when to get the velocity
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27684

Requires:

- module:getLayerWorldVelocity

Returns:
A positive number. The speed.
Type: `number`

#### # static "getLayerWorldVelocity"(topt, lopt) → {Array.<number>}

Gets the world instant velocity of a layer.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The time when to get the velocity
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27701

Requires:

- module:getLayerWorldPos

Returns:
The velocity.
Type: `Array.<number>`

#### # static "getNextKey"(topt, propopt) → {Key|null}

Gets the key immediately before the given time

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26216

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getNextStopKey"(topt, propopt) → {Key|null}

Gets the next key where there is no motion after it

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26239

Requires:

- module:isStill
- module:getNextKey

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getOrientation"(l) → {float}

Gets the world orientation of a (2D) layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer to get the orientation from

View Source Duik_api_fordoc.jsxinc, line 27716

Requires:

- module:sign

Returns:
The orientation, in degrees.
Type: `float`

#### # static "getOrientationAtTime"(l, topt) → {float}

Gets the world orientation of a (2D) layer at a specific time.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` |  |  | The layer to get the orientation from
`t` | `float` | <optional> | time | The time at which to get the orientation

View Source Duik_api_fordoc.jsxinc, line 27763

Returns:
The orientation, in degrees.
Type: `float`

#### # static "getPath"() → {Object}

Gets the path from the current property at a given time.

View Source Duik_api_fordoc.jsxinc, line 27174

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "getPrevKey"(topt, propopt) → {Key|null}

Gets the key immediately before the given time

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26263

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getPrevStartKey"(topt, propopt) → {Key|null}

Gets the previous key where there is no motion before it

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26286

Requires:

- module:isStill
- module:getPrevKey

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getPropFromPath"(l, p) → {Property}

Gets a property from an array of indices as returned by getPropPath.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer containing the needed property
`p` | `Array.<int>` | The indices to the property.

View Source Duik_api_fordoc.jsxinc, line 27193

Returns:
The property.
Type: `Property`

#### # static "getPropPath"() → {Array.<int>}

Gets an array of all indices needed to get the current property from the layer level.

View Source Duik_api_fordoc.jsxinc, line 27210

Returns:
All indices to the property.
Type: `Array.<int>`

#### # static "getPropWorldSpeed"(topt, propopt) → {Array.<number>}

Gets the world speed of a property.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`prop` | `Layer` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27785

Requires:

- module:getPropWorldVelocity

Returns:
The world speed
Type: `Array.<number>`

#### # static "getPropWorldValue"(topt, propopt) → {Array.<number>}

Gets the world coordinates of a property.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`prop` | `Layer` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27802

Requires:

- module:getLayerWorldPos
- module:isPosition

Returns:
The world coordinates
Type: `Array.<number>`

#### # static "getPropWorldVelocity"(topt, propopt) → {Array.<number>}

Gets the world velocity of a property.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`prop` | `Layer` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27822

Requires:

- module:getPropWorldValue

Returns:
The world velocity
Type: `Array.<number>`

#### # static "getSameProp"(l) → {Property}

Gets the same property as the current one but from another layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer containing the needed property

View Source Duik_api_fordoc.jsxinc, line 27238

Requires:

- module:getPropFromPath
- module:getPropPath

Returns:
The property.
Type: `Property`

#### # static "getScale"(l) → {Array.<float>}

Gets the world scale of a layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer to get the scale from

View Source Duik_api_fordoc.jsxinc, line 27836

Returns:
The scale, in percent.
Type: `Array.<float>`

#### # static "inside"(point, points) → {object}

Checks if a point is inside a given polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<float>` | A 2D point [x, y]
`points` | `Array.<Array.<float>>` | The vertices of the polygon

View Source Duik_api_fordoc.jsxinc, line 27024

Returns:
An object with two properties: - `inside (bool)` is true if the point is inside the polygon - `closestVertex` is the index of the closest vertex of the polygon
Type: `object`

#### # static "integrateLinearKeys"(propopt)

Integrates the (linear) keyframe values. Useful to animate frequencies! cf. http://www.motionscript.com/articles/speed-control.html for more explanation.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property with the keyframes.

View Source Duik_api_fordoc.jsxinc, line 25977

#### # static "interpolateColor"(topt, modeopt, tMinopt, tMaxopt, colorAopt, colorBopt, interpolationMethodopt)

Fixes interpolation of colors by using HSL or a smart HSL taking the smallest path

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The value to interpolate and extrapolate
`mode` | `int` | <optional> | 2 | How to interpolate the colors, one of: 0 for 'RGB', 1 for 'HSL', or 2 for 'shortest-path HSL', 3 for 'longest-path HSL', or 4 for 'combined-RGB SL'
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`colorA` | `Array.<number>` | <optional> | [0,0,0,0] | The first color
`colorB` | `Array.<number>` | <optional> | [1,1,1,1] | The second color
`interpolationMethod` | `function` | <optional> | ease | The interpolation function, like linear(), easeIn(), easeOut(), etc. Or any other method taking the same five arguments.

View Source Duik_api_fordoc.jsxinc, line 26009

#### # static "inverseGaussian"(v, minopt, maxopt, centeropt, fwhmopt) → {Array.<Number>}

The inverse gaussian function

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`v` | `Number` |  |  | The variable
`min` | `Number` | <optional> | 0 | The minimum return value of the corresponding gaussian function
`max` | `Number` | <optional> | 1 | The maximum return value of the corresponding gaussian function
`center` | `Number` | <optional> | 0 | The center of the peak of the corresponding gaussian function
`fwhm` | `Number` | <optional> | 1 | The full width at half maximum of the curve of the corresponding gaussian function

View Source Duik_api_fordoc.jsxinc, line 26764

Returns:
The two possible results, the lower is the first in the list. If both are the same, it is the maximum
Type: `Array.<Number>`

#### # static "inverseLogistic"(v, midValueopt, minopt, maxopt, rateopt) → {Number}

The inverse logistic function (inverse sigmoid)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`v` | `Number` |  |  | The variable
`midValue` | `Number` | <optional> | 0 | The midpoint value, at which the function returns max/2 in the original logistic function
`min` | `Number` | <optional> | 0 | The minimum return value of the original logistic function
`max` | `Number` | <optional> | 1 | The maximum return value of the original logistic function
`rate` | `Number` | <optional> | 1 | The logistic growth rate or steepness of the original logistic function

View Source Duik_api_fordoc.jsxinc, line 26794

Returns:
The result
Type: `Number`

#### # static "isAfterLastKey"() → {boolean}

Checks if current time is after the time of the last key in the property

View Source Duik_api_fordoc.jsxinc, line 26308

Returns:
true if time is > lastkey.time
Type: `boolean`

#### # static "isKeyTop"(k, axis) → {boolean}

Checks if the key is a maximum or minimum

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | `Keyframe` | The key to check
`axis` | `int` | The axis to check for multi-dimensionnal properties

View Source Duik_api_fordoc.jsxinc, line 26325

Returns:
true if the key is a maximum or minimum
Type: `boolean`

#### # static "isLayer"(prop) → {boolean}

Checks if a property is a layer. Useful when traversing up the property tree to stop when getting the layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property to test

View Source Duik_api_fordoc.jsxinc, line 27253

Returns:
true if the prop is a layer
Type: `boolean`

#### # static "isLayerFlipped"(lopt) → {bool}

Checks if the layer has been flipped (scale sign is not the same on both axis).

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27866

Requires:

- module:sign

Returns:
Whether the layer is flipped
Type: `bool`

#### # static "isPath"(prop) → {boolean}

Checks if a property is a path property.

##### Parameters:

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

View Source Duik_api_fordoc.jsxinc, line 27268

Returns:
true if the property is a path property.
Type: `boolean`

#### # static "isPosition"(propopt) → {boolean}

Checks if a property is a transform.position property.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27288

Returns:
true if the property is the transform.position property.
Type: `boolean`

#### # static "isSpatial"(propopt) → {boolean}

Checks if a property is spatial

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property to check

View Source Duik_api_fordoc.jsxinc, line 27302

Returns:
true if the property is spatial.
Type: `boolean`

#### # static "isStill"(topt, thresholdopt, axisopt) → {boolean}

Checks if the current property is animated at a given time.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The time
`threshold` | `number` | <optional> | 0.01 | The speed under which the property is considered still.
`axis` | `number` | <optional> | -1 | The axis to check. If < 0, will check all axis.

View Source Duik_api_fordoc.jsxinc, line 27322

Returns:
true if the property does not vary.
Type: `boolean`

#### # static "isZero"(x) → {Boolean}

Checks if the value is 0; works with arrays.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | `Number` | `Array.<Number>` | The value(s)

View Source Duik_api_fordoc.jsxinc, line 26814

Returns:
true if all values are 0.
Type: `Boolean`

#### # static "lastActiveTime"(prop, t) → {float}

Checks the last previous time at which the property value was not 0. (meant to be used on boolean property, works on single dimension properties too).

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property to check
`t` | `float` | The time before which to run the check

View Source Duik_api_fordoc.jsxinc, line 27348

Requires:

- module:getPrevKey

Returns:
The last active time before t
Type: `float`

#### # static "limit"(value, minopt, maxopt, softnessopt)

Clamps a value, but with a smooth interpolation according to a softness parameter

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | `number` | `Array.<number>` |  |  | The value to limit
`min` | `number` | `Array.<number>` | `null` | <optional> |  | The minimum value
`max` | `number` | `Array.<number>` | `null` | <optional> |  | The maximum value
`softness` | `number` | <optional> | 0 | The softness, a value corresponding value, from which the interpolation begins to slow down

View Source Duik_api_fordoc.jsxinc, line 26068

#### # static "linearExtrapolation"(t, tMinopt, tMaxopt, value1opt, value2opt) → {number}

Interpolates a value with a linear function, but also extrapolates it outside of known values.
This method can replace `linear()`, adding extrapolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate and extrapolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result

View Source Duik_api_fordoc.jsxinc, line 26131

Returns:
the value.
Type: `number`

#### # static "logInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}

Interpolates a value with a logarithmic function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 1 | The raising speed in the range [0, inf].

View Source Duik_api_fordoc.jsxinc, line 26155

Requires:

- module:linearExtrapolation

Returns:
the value.
Type: `number`

#### # static "logistic"(value, midValueopt, minopt, maxopt, rateopt) → {Number}

The logistic function (sigmoid)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | `Number` |  |  | The value
`midValue` | `Number` | <optional> | 0 | The midpoint value, at which the function returns max/2
`min` | `Number` | <optional> | 0 | The minimum return value
`max` | `Number` | <optional> | 1 | The maximum return value
`rate` | `Number` | <optional> | 1 | The logistic growth rate or steepness of the function

View Source Duik_api_fordoc.jsxinc, line 26841

Returns:
The result in the range [min, max] (excluding min and max)
Type: `Number`

#### # static "logisticInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt, tMidopt) → {number}

Interpolates a value with a logistic (sigmoid) function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 1 | The raising speed in the range [0, inf].
`tMid` | `number` | <optional> |  | The t value at which the interpolated value should be half way. By default, (tMin+tMax)/2

View Source Duik_api_fordoc.jsxinc, line 26190

Requires:

- module:logistic
- module:linearExtrapolation

Returns:
the value.s
Type: `number`

#### # static "mean"(values) → {Number}

Returns the mean of a set of values

##### Parameters:

Name | Type | Description
--- | --- | ---
`values` | `Array.<Number>` | The values

View Source Duik_api_fordoc.jsxinc, line 26862

Returns:
The mean
Type: `Number`

#### # static "multPath"(path, weight) → {Object}

Multiplies a path with a scalar.
The path must be an object with three array attributes: points, inTangents, outTangents

##### Parameters:

Name | Type | Description
--- | --- | ---
`path` | `Object` | The path
`weight` | `float` | The multipliers

View Source Duik_api_fordoc.jsxinc, line 27061

Requires:

- module:multPoints

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "multPoints"(p, w) → {Array.<Array.<float>>}

Multiplies a list of points/vectors with a scalar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p` | `Array.<Array.<float>>` | The list of points
`w` | `float` | The multiplier

View Source Duik_api_fordoc.jsxinc, line 26884

Returns:
The multiplied points
Type: `Array.<Array.<float>>`

#### # static "multSets"(setA, setB) → {Array.<float>}

Multiplies two sets of values, one with each other. If the lists are not the same length, additional values will be ignored

##### Parameters:

Name | Type | Description
--- | --- | ---
`setA` | `Array.<float>` | The first list
`setB` | `Array.<float>` | The other list

View Source Duik_api_fordoc.jsxinc, line 26903

Returns:
The new values
Type: `Array.<float>`

#### # static "nextActiveTime"(prop, t) → {float}

Checks the next time at which the property value was not 0. (meant to be used on boolean property, works on single dimension properties too).

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property to check
`t` | `float` | The time after which to run the check

View Source Duik_api_fordoc.jsxinc, line 27372

Requires:

- module:getNextKey

Returns:
The next active time after t
Type: `float`

#### # static "normalizeWeights"(weights, sumopt) → {Array.<float>}

Normalizes a list of weights so their sum equals 1.0

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`weights` | `Array.<float>` |  | The weights to normalize
`sum` | `float` | <optional> | The sum of the weights; provide it if it's already computed to improve performance.

View Source Duik_api_fordoc.jsxinc, line 26926

Returns:
The normalized weights
Type: `Array.<float>`

#### # static "overshoot"(t, elasticity, damping, vAtTimeopt) → {float|Array.<float>}

Overshoot animation, to be used when the speed is 0.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`elasticity` | `float` |  |  | The elasticity, which controls the amplitude and frequence according to the last known velocity
`damping` | `float` |  |  | Damping
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.

View Source Duik_api_fordoc.jsxinc, line 26543

Requires:

- module:getPrevKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "pingPongIn"(t, nK, vAtTimeopt, dampingopt) → {float}

Animatable equivalent to loopIn('pingpong').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all previous frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26580

Requires:

- module:getNextKey

Returns:
The new value
Type: `float`

#### # static "pingPongOut"(t, nK, vAtTimeopt, dampingopt) → {float}

Animatable equivalent to loopOut('pingpong'). Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26622

Requires:

- module:getPrevKey

Returns:
The new value
Type: `float`

#### # static "pointsToWorld"(points, layer) → {Array.<Array.<float>>}

Transform the points from layer to world coordinates

##### Parameters:

Name | Type | Description
--- | --- | ---
`points` | `Array.<Array.<float>>` | The points
`layer` | `Layer` | The layer

View Source Duik_api_fordoc.jsxinc, line 28072

Returns:
The points in world coordinates
Type: `Array.<Array.<float>>`

#### # static "shapePointsToLayer"(prop) → {Array.<Array.<float>>}

Gets the points of the shape path in layer coordinates (applies the group transform)

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property from which to get the path

View Source Duik_api_fordoc.jsxinc, line 28090

Requires:

- module:getGroupTransformMatrix

Returns:
The points in layer coordinates
Type: `Array.<Array.<float>>`

#### # static "subPath"(path1, path2, path2weight) → {Object}

Substracts two paths together.
The paths must be objects with three array attributes: points, inTangents, outTangents

##### Parameters:

Name | Type | Description
--- | --- | ---
`path1` | `Object` | First path
`path2` | `Object` | Second path
`path2weight` | `float` | A weight to multiply the second path values

View Source Duik_api_fordoc.jsxinc, line 27086

Requires:

- module:subPoints

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "subPoints"(p1, p2, w) → {Array.<Array.<float>>}

Substracts two lists of points/vectors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | `Array.<Array.<float>>` | The list of points
`p2` | `Array.<Array.<float>>` | The other list of points
`w` | `float` | A weight to multiply the values of p2

View Source Duik_api_fordoc.jsxinc, line 26968

Returns:
The substracted points
Type: `Array.<Array.<float>>`

#### # static "translatePointWithLayer"(l, pointopt, startTopt, endTopt) → {Array.<float>}

Translates a point with a layer, as if it was parented to it.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` |  |  | The layer to get the translation from.
`point` | `Array.<float>` | <optional> | [0,0] | The [X,Y] point to translate (using world coordinates).
`startT` | `float` | <optional> | 0 | The start time of the translation
`endT` | `float` | <optional> | time | The end time of the translation

View Source Duik_api_fordoc.jsxinc, line 28113

Returns:
The coordinates of the translated point.
Type: `Array.<float>`

#### # static "zero"() → {any}

Generates a "zero" value for the current property, i.e. `0` or `[0,0]`, etc. according to the property type.
Note that for path properties, this method returns a path object with three array attributes: points, inTangents, outTangents.

View Source Duik_api_fordoc.jsxinc, line 27395

Returns:
The zero value.
Type: `any`

#### # static get(functions) → {string}

Gets functions and their dependencies from the library.

##### Parameters:

Name | Type | Description
--- | --- | ---
`functions` | `Array.<string>` | The name of the functions to get

View Source Duik_api_fordoc.jsxinc, line 25099

Returns:
The expression
Type: `string`

#### # static getRequirements(functionName) → {Array.<string>}

A recursive method to get all the requirements (dependencies) of a function from a library

##### Parameters:

Name | Type | Description
--- | --- | ---
`functionName` | `string` | The name of the function

View Source Duik_api_fordoc.jsxinc, line 25130

Returns:
The names of the required functions, including the querried one
Type: `Array.<string>`

## DuAEExpression.Library

Expression Library
Using DuAEF, you can easily include the methods and classes listed here to your expressions,
using `DuAEExpression.Library.get` and `DuAEExpression.Library.getRequirements`. These methods take the name of the function/class as arguments.

View Source Duik_api_fordoc.jsxinc, line 25173

### Classes

"FuzzyLogic"
"FuzzyVeracity"
"Matrix"

# Methods

#### # static "addNoise"(val, quantity)

Adds some noise to a value.
You may use seedRandom() before using this function as it will influence the generated noise. A timeless noise can be achieved with `seedRandom(index,true)` for example.

##### Parameters:

Name | Type | Description
--- | --- | ---
`val` | `number` | `Array.<number>` | The value to add noise to.
`quantity` | `float` | The quantity of noise. A percentage. 100 means the value can range from (val * 0) to (val * 2).

View Source Duik_api_fordoc.jsxinc, line 27443

##### Examples

    seedRandom(index, true) // a timeless noise
    addNoise(value, 50 ); // the property value will have noise between (value * 0.5) and (value * 1.5) which won't vary through time.

    seedRandom(index, false);
    addNoise(value, 33 ); // the noise will change at each frame, varying between (value * .66) and (value * 1.33)

#### # static "addPath"(path1, path2, path2weight) → {Object}

Adds two paths together.
The paths must be objects with three array attributes: points, inTangents, outTangents

##### Parameters:

Name | Type | Description
--- | --- | ---
`path1` | `Object` | First path
`path2` | `Object` | Second path
`path2weight` | `float` | A weight to multiply the second path values

View Source Duik_api_fordoc.jsxinc, line 27000

Requires:

- module:addPoints

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "addPoints"(p1, p2, w) → {Array.<Array.<float>>}

Adds two lists of points/vectors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | `Array.<Array.<float>>` | The list of points
`p2` | `Array.<Array.<float>>` | The other list of points
`w` | `float` | A weight to multiply the values of p2

View Source Duik_api_fordoc.jsxinc, line 26661

Returns:
The added points
Type: `Array.<Array.<float>>`

#### # static "animate"(keyframes, loopOutopt, loopInopt, timeopt) → {number}

Animates the property using the given keyframes

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`keyframes` | `Array.<Object>` |  |  | The keyframes. An object with four properties: `value` The value of the keyframe `time` The time of the keyframe `interpolation` (optional. Default: linear) A function taking 5 arguments to interpolate between this keyframe and the next one `params` (optional.) A sixth argument passed to the interpolation function. To be used with DuAEF interpolations. Note that the keyframes must be sorted. The function does not sort them, as it would have a bad impact on performance.
`loopOut` | `string` | <optional> | 'none' | One of 'none', 'cycle', 'pingpong'.
`loopIn` | `string` | <optional> | 'none' | One of 'none', 'cycle', 'pingpong'.
`time` | `float` | <optional> | time | Use this to control how time flows.

View Source Duik_api_fordoc.jsxinc, line 25772

Returns:
the animated value.
Type: `number`

##### Example

    var keyframes = [
       {value: 0, time: 1, interpolation: linear},
       {value: 180, time: 2, interpolation: gaussianInterpolation, params: -0.5}, //You need to include the gaussianInterpolation function from DuAEF
       {value: 250, time: 4, interpolation: ease},
       {value: 360, time: 5},
    ];
    animate(keyframes, 'cycle', 'pingpong');

#### # static "bezierInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, bezierPointsopt) → {number}

Interpolates a value with a bezier curve.
This method can replace `linear()` and `ease()` with a custom bézier interpolation.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`bezierPoints` | `Array.<number>` | <optional> | [0.33,0.0,0.66,1.0] | an Array of 4 coordinates wihtin the [0.0, 1.0] range which describes the Bézier interpolation. The default mimics the native ease() function [ outTangentX, outTangentY, inTangentX, inTangentY ]

View Source Duik_api_fordoc.jsxinc, line 25834

Returns:
the value.
Type: `number`

#### # static "blendColor"(colorA, colorB, opacityopt, blendlingModeopt) → {Array.<float>}

Blends two colors together

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`colorA` | `Array.<float>` |  |  | The first color
`colorB` | `Array.<float>` |  |  | The second color
`opacity` | `float` | <optional> |  | The opacity of the second color, overrides colorB[3].
`blendlingMode` | `int` | <optional> | 0 | The blending mode, one of: 0: Normal 1: Add 2: Lighter color 3: Multiply 4: Darker color

View Source Duik_api_fordoc.jsxinc, line 25199

Requires:

- module:blendColorValue

Returns:
The new color
Type: `Array.<float>`

#### # static "blendColorValue"(colorA, colorB, opacityopt, blendlingModeopt) → {float}

Blends two colors together

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`colorA` | `float` |  |  | The first color
`colorB` | `float` |  |  | The second color
`opacity` | `float` | <optional> | 1 | The opacity
`blendlingMode` | `int` | <optional> | 0 | The blending mode, one of: 0: Normal 1: Add 3: Multiply

View Source Duik_api_fordoc.jsxinc, line 25239

Returns:
The new value
Type: `float`

#### # static "bounce"(t, elasticity, damping, vAtTimeopt) → {float|Array.<float>}

Bounce, to be used when the speed is 0.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`elasticity` | `float` |  |  | The elasticity, which controls the amplitude and frequence according to the last known velocity
`damping` | `float` |  |  | Damping
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.

View Source Duik_api_fordoc.jsxinc, line 26351

Requires:

- module:getPrevKey
- module:bezierInterpolation

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "checkDuikEffect"(fx, duikMatchName) → {boolean}

Checks the type of a pseudo-effect used by Duik.
This is a workaround for the missing matchName in expressions.
Pseudo-Effects used by Duik start with a hidden property which name is the same as the matchName of the effect itself (without the 'Pseudo/' part).

##### Parameters:

Name | Type | Description
--- | --- | ---
`fx` | `Property` | The effect to check
`duikMatchName` | `string` | The matchName of a pseudo-effect used by Duik (without the 'Pseudo/' part)

View Source Duik_api_fordoc.jsxinc, line 27113

Returns:
True when the property at propIndex is named propName
Type: `boolean`

##### Example

    if ( checkEffect(thisLayer.effect(1), "DUIK parentConstraint2") ) { "This is the second version of the parent constraint by Duik" }
    else { "Who knows what this is?" }

#### # static "checkEffect"(fx, propIndex, propName) → {boolean}

Checks the type of an effect.
This is a workaround for the missing matchName in expressions.
It checks if the given effect has a specific property at a specific index.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fx` | `Property` | The effect to check
`propIndex` | `int` | The index of the property
`propName` | `string` | The expected name of the property. Be careful with the internationalization of After Effects...

View Source Duik_api_fordoc.jsxinc, line 27137

Returns:
True when the property at propIndex is named propName
Type: `boolean`

##### Example

    if ( checkEffect(thisLayer.effect(1), 1, "Blur") ) { "The first effect is a blur!" }
    else { "Who knows what this is?" }

#### # static "continueIn"(t, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopIn('continue').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all previous frames.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26415

Requires:

- module:getNextKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "continueOut"(t, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopOut('continue').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26437

Requires:

- module:getNextKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "cycleIn"(t, nK, o, vAtTimeopt, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopIn('cycle') and loopIn('offset').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all previous frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`o` | `Boolean` |  |  | Wether to offset or cycle
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26462

Requires:

- module:getNextKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "cycleOut"(t, nK, o, vAtTimeopt, dampingopt) → {float|Array.<float>}

Animatable equivalent to loopOut('cycle') and loopOut('offset').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`o` | `Boolean` |  |  | Wether to offset or cycle
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26503

Requires:

- module:getPrevKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "dishineritRotation"(lopt) → {float}

Removes the ancestors rotation from the rotation of a layer. This is very useful to make a layer keep its orientation without being influenced by its parents.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27471

Requires:

- module:sign

Returns:
The new rotation value, in degrees.
Type: `float`

##### Examples

    //in a rotation property, just include the function and use:
    dishineritRotation();
    //the layer will now keep its own orientation.

    //you can also combine the result with something else
    var result = dishineritRotation();
    result + wiggle(5,20);

#### # static "dishineritScale"(lopt) → {Array.<float>}

Removes the ancestors scale from the scale of a layer. This is very useful to make a layer keep its scale without being influenced by its parents.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27503

Returns:
The new scale value, in percent.
Type: `Array.<float>`

##### Examples

    //in a rotation property, just include the function and use:
    dishineritScale();
    //the layer will now keep its own scale.

    //you can also combine the result with something else
    var result = dishineritScale();
    result + wiggle(5,20);

#### # static "distanceToLine"(point, line) → {float}

Gets the distance of a point to a line

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<float>` | The point [x,y]
`line` | `Array.<Array.<float>>` | The line [ A , B ] where A and B are two points

View Source Duik_api_fordoc.jsxinc, line 26709

Returns:
The distance
Type: `float`

#### # static "expInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}

Interpolates a value with an exponential function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 1 | The raising speed in the range [0, inf].

View Source Duik_api_fordoc.jsxinc, line 25882

Requires:

- module:linearExtrapolation

Returns:
the value.
Type: `number`

#### # static "fromGroupToLayer"(point) → {Array.<number>}

Converts the point coordinates from the current group in the shape layer to the Layer.
Use toWorld and toComp with the result if you need te coordinates in the world or the comp.

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<number>` | The 2D coordinates of the point in the current group.

View Source Duik_api_fordoc.jsxinc, line 27535

Requires:

- module:Matrix
- module:getGroupTransformMatrix

Returns:
The 2D coordinates of the point in the Layer.
Type: `Array.<number>`

#### # static "fromLayerToGroup"(point) → {Array.<number>}

Converts the point coordinates from Layer to the current group in the shape layer.
Use fromWorld or fromComp first if you need to convert from the world or composition coordinates, and pass the result to this function.

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<number>` | The 2D coordinates of the point in the Layer.

View Source Duik_api_fordoc.jsxinc, line 27553

Requires:

- module:Matrix
- module:getGroupTransformMatrix

Returns:
The 2D coordinates of the point in the current group.
Type: `Array.<number>`

#### # static "gaussian"(value, minopt, maxopt, centeropt, fwhmopt) → {Number}

The gaussian function

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | `Number` |  |  | The variable
`min` | `Number` | <optional> | 0 | The minimum return value
`max` | `Number` | <optional> | 1 | The maximum return value
`center` | `Number` | <optional> | 0 | The center of the peak
`fwhm` | `Number` | <optional> | 1 | The full width at half maximum of the curve

View Source Duik_api_fordoc.jsxinc, line 26735

Returns:
The result
Type: `Number`

#### # static "gaussianInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}

Interpolates a value with a gaussian function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 0 | The raising speed in the range [-1.0, 1.0].

View Source Duik_api_fordoc.jsxinc, line 25914

Returns:
the value.
Type: `number`

#### # static "gaussianRateToBezierPoints"(rate) → {number}

Converts a Gaussian rate (as used with `gaussianInterpolation`) to the closest possible Bézier controls for use with `bezierInterpolation`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`rate` | `number` | The raising speed in the range [-1.0, 1.0].

View Source Duik_api_fordoc.jsxinc, line 25953

Returns:
the value.
Type: `number`

#### # static "getCompScale"(lopt, topt) → {number}

Gets the "real" scale of a layer, resulting to its scale property, the scale of its parents, and it's location in Z-space if it's 3D.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer
`t` | `number` | <optional> | time | The time when to get the scale

View Source Duik_api_fordoc.jsxinc, line 27570

Returns:
The scale ratio. This is not a percent, 1.0 is 100%.
Type: `number`

#### # static "getEffectLayer"(fx, ind) → {Layer|null}

Gets a layer from a layer property in an effect, without generating an error if "None" is selected with the Legacy expression engine.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fx` | `Property` | The effect
`ind` | `int` | `string` | The index or the name of the property

View Source Duik_api_fordoc.jsxinc, line 27160

Returns:
The layer, or null if set to "None"
Type: `Layer` | `null`

#### # static "getGroupTransformMatrix"(propopt) → {Matrix}

Gets the transformation Matrix for the current group in a shape layer, including the transformation from the ancestor groups
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property from which to get the matrix

View Source Duik_api_fordoc.jsxinc, line 27591

Requires:

- module:isLayer
- module:Matrix

Returns:
The 2D Transform Matrix.
Type: `Matrix`

#### # static "getLayerCompPos"(topt, lopt) → {Array.<number>}

Gets the comp position (2D Projection in the comp) of a layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27625

Returns:
The comp position
Type: `Array.<number>`

#### # static "getLayerDistance"(other, originopt, topt) → {Array.<number>}

Gets the world position of a layer.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`other` | `Layer` |  |  | The other layer
`origin` | `Layer` | <optional> | thisLayer | The origin
`t` | `number` | <optional> | time | Time from when to get the position

View Source Duik_api_fordoc.jsxinc, line 27646

Requires:

- module:getLayerWorldPos

Returns:
The world position
Type: `Array.<number>`

#### # static "getLayerWorldPos"(topt, lopt) → {Array.<number>}

Gets the world position of a layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27665

Returns:
The world position
Type: `Array.<number>`

#### # static "getLayerWorldSpeed"(topt, lopt) → {number}

Gets the world instant speed of a layer.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The time when to get the velocity
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27684

Requires:

- module:getLayerWorldVelocity

Returns:
A positive number. The speed.
Type: `number`

#### # static "getLayerWorldVelocity"(topt, lopt) → {Array.<number>}

Gets the world instant velocity of a layer.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The time when to get the velocity
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27701

Requires:

- module:getLayerWorldPos

Returns:
The velocity.
Type: `Array.<number>`

#### # static "getNextKey"(topt, propopt) → {Key|null}

Gets the key immediately before the given time

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26216

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getNextStopKey"(topt, propopt) → {Key|null}

Gets the next key where there is no motion after it

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26239

Requires:

- module:isStill
- module:getNextKey

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getOrientation"(l) → {float}

Gets the world orientation of a (2D) layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer to get the orientation from

View Source Duik_api_fordoc.jsxinc, line 27716

Requires:

- module:sign

Returns:
The orientation, in degrees.
Type: `float`

#### # static "getOrientationAtTime"(l, topt) → {float}

Gets the world orientation of a (2D) layer at a specific time.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` |  |  | The layer to get the orientation from
`t` | `float` | <optional> | time | The time at which to get the orientation

View Source Duik_api_fordoc.jsxinc, line 27763

Returns:
The orientation, in degrees.
Type: `float`

#### # static "getPath"() → {Object}

Gets the path from the current property at a given time.

View Source Duik_api_fordoc.jsxinc, line 27174

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "getPrevKey"(topt, propopt) → {Key|null}

Gets the key immediately before the given time

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26263

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getPrevStartKey"(topt, propopt) → {Key|null}

Gets the previous key where there is no motion before it

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time at which to get the key
`prop` | `Property` | <optional> | thisProperty | The property from which to get the key

View Source Duik_api_fordoc.jsxinc, line 26286

Requires:

- module:isStill
- module:getPrevKey

Returns:
The key, or null if there's no key before.
Type: `Key` | `null`

#### # static "getPropFromPath"(l, p) → {Property}

Gets a property from an array of indices as returned by getPropPath.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer containing the needed property
`p` | `Array.<int>` | The indices to the property.

View Source Duik_api_fordoc.jsxinc, line 27193

Returns:
The property.
Type: `Property`

#### # static "getPropPath"() → {Array.<int>}

Gets an array of all indices needed to get the current property from the layer level.

View Source Duik_api_fordoc.jsxinc, line 27210

Returns:
All indices to the property.
Type: `Array.<int>`

#### # static "getPropWorldSpeed"(topt, propopt) → {Array.<number>}

Gets the world speed of a property.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`prop` | `Layer` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27785

Requires:

- module:getPropWorldVelocity

Returns:
The world speed
Type: `Array.<number>`

#### # static "getPropWorldValue"(topt, propopt) → {Array.<number>}

Gets the world coordinates of a property.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`prop` | `Layer` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27802

Requires:

- module:getLayerWorldPos
- module:isPosition

Returns:
The world coordinates
Type: `Array.<number>`

#### # static "getPropWorldVelocity"(topt, propopt) → {Array.<number>}

Gets the world velocity of a property.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | Time from when to get the position
`prop` | `Layer` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27822

Requires:

- module:getPropWorldValue

Returns:
The world velocity
Type: `Array.<number>`

#### # static "getSameProp"(l) → {Property}

Gets the same property as the current one but from another layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer containing the needed property

View Source Duik_api_fordoc.jsxinc, line 27238

Requires:

- module:getPropFromPath
- module:getPropPath

Returns:
The property.
Type: `Property`

#### # static "getScale"(l) → {Array.<float>}

Gets the world scale of a layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l` | `Layer` | The layer to get the scale from

View Source Duik_api_fordoc.jsxinc, line 27836

Returns:
The scale, in percent.
Type: `Array.<float>`

#### # static "inside"(point, points) → {object}

Checks if a point is inside a given polygon.

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Array.<float>` | A 2D point [x, y]
`points` | `Array.<Array.<float>>` | The vertices of the polygon

View Source Duik_api_fordoc.jsxinc, line 27024

Returns:
An object with two properties: - `inside (bool)` is true if the point is inside the polygon - `closestVertex` is the index of the closest vertex of the polygon
Type: `object`

#### # static "integrateLinearKeys"(propopt)

Integrates the (linear) keyframe values. Useful to animate frequencies! cf. http://www.motionscript.com/articles/speed-control.html for more explanation.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property with the keyframes.

View Source Duik_api_fordoc.jsxinc, line 25977

#### # static "interpolateColor"(topt, modeopt, tMinopt, tMaxopt, colorAopt, colorBopt, interpolationMethodopt)

Fixes interpolation of colors by using HSL or a smart HSL taking the smallest path

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The value to interpolate and extrapolate
`mode` | `int` | <optional> | 2 | How to interpolate the colors, one of: 0 for 'RGB', 1 for 'HSL', or 2 for 'shortest-path HSL', 3 for 'longest-path HSL', or 4 for 'combined-RGB SL'
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`colorA` | `Array.<number>` | <optional> | [0,0,0,0] | The first color
`colorB` | `Array.<number>` | <optional> | [1,1,1,1] | The second color
`interpolationMethod` | `function` | <optional> | ease | The interpolation function, like linear(), easeIn(), easeOut(), etc. Or any other method taking the same five arguments.

View Source Duik_api_fordoc.jsxinc, line 26009

#### # static "inverseGaussian"(v, minopt, maxopt, centeropt, fwhmopt) → {Array.<Number>}

The inverse gaussian function

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`v` | `Number` |  |  | The variable
`min` | `Number` | <optional> | 0 | The minimum return value of the corresponding gaussian function
`max` | `Number` | <optional> | 1 | The maximum return value of the corresponding gaussian function
`center` | `Number` | <optional> | 0 | The center of the peak of the corresponding gaussian function
`fwhm` | `Number` | <optional> | 1 | The full width at half maximum of the curve of the corresponding gaussian function

View Source Duik_api_fordoc.jsxinc, line 26764

Returns:
The two possible results, the lower is the first in the list. If both are the same, it is the maximum
Type: `Array.<Number>`

#### # static "inverseLogistic"(v, midValueopt, minopt, maxopt, rateopt) → {Number}

The inverse logistic function (inverse sigmoid)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`v` | `Number` |  |  | The variable
`midValue` | `Number` | <optional> | 0 | The midpoint value, at which the function returns max/2 in the original logistic function
`min` | `Number` | <optional> | 0 | The minimum return value of the original logistic function
`max` | `Number` | <optional> | 1 | The maximum return value of the original logistic function
`rate` | `Number` | <optional> | 1 | The logistic growth rate or steepness of the original logistic function

View Source Duik_api_fordoc.jsxinc, line 26794

Returns:
The result
Type: `Number`

#### # static "isAfterLastKey"() → {boolean}

Checks if current time is after the time of the last key in the property

View Source Duik_api_fordoc.jsxinc, line 26308

Returns:
true if time is > lastkey.time
Type: `boolean`

#### # static "isKeyTop"(k, axis) → {boolean}

Checks if the key is a maximum or minimum

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | `Keyframe` | The key to check
`axis` | `int` | The axis to check for multi-dimensionnal properties

View Source Duik_api_fordoc.jsxinc, line 26325

Returns:
true if the key is a maximum or minimum
Type: `boolean`

#### # static "isLayer"(prop) → {boolean}

Checks if a property is a layer. Useful when traversing up the property tree to stop when getting the layer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property to test

View Source Duik_api_fordoc.jsxinc, line 27253

Returns:
true if the prop is a layer
Type: `boolean`

#### # static "isLayerFlipped"(lopt) → {bool}

Checks if the layer has been flipped (scale sign is not the same on both axis).

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` | <optional> | thisLayer | The layer

View Source Duik_api_fordoc.jsxinc, line 27866

Requires:

- module:sign

Returns:
Whether the layer is flipped
Type: `bool`

#### # static "isPath"(prop) → {boolean}

Checks if a property is a path property.

##### Parameters:

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

View Source Duik_api_fordoc.jsxinc, line 27268

Returns:
true if the property is a path property.
Type: `boolean`

#### # static "isPosition"(propopt) → {boolean}

Checks if a property is a transform.position property.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property

View Source Duik_api_fordoc.jsxinc, line 27288

Returns:
true if the property is the transform.position property.
Type: `boolean`

#### # static "isSpatial"(propopt) → {boolean}

Checks if a property is spatial

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`prop` | `Property` | <optional> | thisProperty | The property to check

View Source Duik_api_fordoc.jsxinc, line 27302

Returns:
true if the property is spatial.
Type: `boolean`

#### # static "isStill"(topt, thresholdopt, axisopt) → {boolean}

Checks if the current property is animated at a given time.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` | <optional> | time | The time
`threshold` | `number` | <optional> | 0.01 | The speed under which the property is considered still.
`axis` | `number` | <optional> | -1 | The axis to check. If < 0, will check all axis.

View Source Duik_api_fordoc.jsxinc, line 27322

Returns:
true if the property does not vary.
Type: `boolean`

#### # static "isZero"(x) → {Boolean}

Checks if the value is 0; works with arrays.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | `Number` | `Array.<Number>` | The value(s)

View Source Duik_api_fordoc.jsxinc, line 26814

Returns:
true if all values are 0.
Type: `Boolean`

#### # static "lastActiveTime"(prop, t) → {float}

Checks the last previous time at which the property value was not 0. (meant to be used on boolean property, works on single dimension properties too).

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property to check
`t` | `float` | The time before which to run the check

View Source Duik_api_fordoc.jsxinc, line 27348

Requires:

- module:getPrevKey

Returns:
The last active time before t
Type: `float`

#### # static "limit"(value, minopt, maxopt, softnessopt)

Clamps a value, but with a smooth interpolation according to a softness parameter

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | `number` | `Array.<number>` |  |  | The value to limit
`min` | `number` | `Array.<number>` | `null` | <optional> |  | The minimum value
`max` | `number` | `Array.<number>` | `null` | <optional> |  | The maximum value
`softness` | `number` | <optional> | 0 | The softness, a value corresponding value, from which the interpolation begins to slow down

View Source Duik_api_fordoc.jsxinc, line 26068

#### # static "linearExtrapolation"(t, tMinopt, tMaxopt, value1opt, value2opt) → {number}

Interpolates a value with a linear function, but also extrapolates it outside of known values.
This method can replace `linear()`, adding extrapolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate and extrapolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result

View Source Duik_api_fordoc.jsxinc, line 26131

Returns:
the value.
Type: `number`

#### # static "logInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}

Interpolates a value with a logarithmic function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 1 | The raising speed in the range [0, inf].

View Source Duik_api_fordoc.jsxinc, line 26155

Requires:

- module:linearExtrapolation

Returns:
the value.
Type: `number`

#### # static "logistic"(value, midValueopt, minopt, maxopt, rateopt) → {Number}

The logistic function (sigmoid)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | `Number` |  |  | The value
`midValue` | `Number` | <optional> | 0 | The midpoint value, at which the function returns max/2
`min` | `Number` | <optional> | 0 | The minimum return value
`max` | `Number` | <optional> | 1 | The maximum return value
`rate` | `Number` | <optional> | 1 | The logistic growth rate or steepness of the function

View Source Duik_api_fordoc.jsxinc, line 26841

Returns:
The result in the range [min, max] (excluding min and max)
Type: `Number`

#### # static "logisticInterpolation"(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt, tMidopt) → {number}

Interpolates a value with a logistic (sigmoid) function.
This method can replace `linear()` and `ease()` with a gaussian interpolation.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `number` |  |  | The value to interpolate
`tMin` | `number` | <optional> | 0 | The minimum value of the initial range
`tMax` | `number` | <optional> | 1 | The maximum value of the initial range
`value1` | `number` | <optional> | 0 | The minimum value of the interpolated result
`value2` | `number` | <optional> | 1 | The maximum value of the interpolated result
`rate` | `number` | <optional> | 1 | The raising speed in the range [0, inf].
`tMid` | `number` | <optional> |  | The t value at which the interpolated value should be half way. By default, (tMin+tMax)/2

View Source Duik_api_fordoc.jsxinc, line 26190

Requires:

- module:logistic
- module:linearExtrapolation

Returns:
the value.s
Type: `number`

#### # static "mean"(values) → {Number}

Returns the mean of a set of values

##### Parameters:

Name | Type | Description
--- | --- | ---
`values` | `Array.<Number>` | The values

View Source Duik_api_fordoc.jsxinc, line 26862

Returns:
The mean
Type: `Number`

#### # static "multPath"(path, weight) → {Object}

Multiplies a path with a scalar.
The path must be an object with three array attributes: points, inTangents, outTangents

##### Parameters:

Name | Type | Description
--- | --- | ---
`path` | `Object` | The path
`weight` | `float` | The multipliers

View Source Duik_api_fordoc.jsxinc, line 27061

Requires:

- module:multPoints

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "multPoints"(p, w) → {Array.<Array.<float>>}

Multiplies a list of points/vectors with a scalar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p` | `Array.<Array.<float>>` | The list of points
`w` | `float` | The multiplier

View Source Duik_api_fordoc.jsxinc, line 26884

Returns:
The multiplied points
Type: `Array.<Array.<float>>`

#### # static "multSets"(setA, setB) → {Array.<float>}

Multiplies two sets of values, one with each other. If the lists are not the same length, additional values will be ignored

##### Parameters:

Name | Type | Description
--- | --- | ---
`setA` | `Array.<float>` | The first list
`setB` | `Array.<float>` | The other list

View Source Duik_api_fordoc.jsxinc, line 26903

Returns:
The new values
Type: `Array.<float>`

#### # static "nextActiveTime"(prop, t) → {float}

Checks the next time at which the property value was not 0. (meant to be used on boolean property, works on single dimension properties too).

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property to check
`t` | `float` | The time after which to run the check

View Source Duik_api_fordoc.jsxinc, line 27372

Requires:

- module:getNextKey

Returns:
The next active time after t
Type: `float`

#### # static "normalizeWeights"(weights, sumopt) → {Array.<float>}

Normalizes a list of weights so their sum equals 1.0

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`weights` | `Array.<float>` |  | The weights to normalize
`sum` | `float` | <optional> | The sum of the weights; provide it if it's already computed to improve performance.

View Source Duik_api_fordoc.jsxinc, line 26926

Returns:
The normalized weights
Type: `Array.<float>`

#### # static "overshoot"(t, elasticity, damping, vAtTimeopt) → {float|Array.<float>}

Overshoot animation, to be used when the speed is 0.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`elasticity` | `float` |  |  | The elasticity, which controls the amplitude and frequence according to the last known velocity
`damping` | `float` |  |  | Damping
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.

View Source Duik_api_fordoc.jsxinc, line 26543

Requires:

- module:getPrevKey

Returns:
The new value
Type: `float` | `Array.<float>`

#### # static "pingPongIn"(t, nK, vAtTimeopt, dampingopt) → {float}

Animatable equivalent to loopIn('pingpong').

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all previous frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26580

Requires:

- module:getNextKey

Returns:
The new value
Type: `float`

#### # static "pingPongOut"(t, nK, vAtTimeopt, dampingopt) → {float}

Animatable equivalent to loopOut('pingpong'). Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`t` | `float` |  |  | The time at which the value must be got. To end the loop, pass the same time for all subsequent frames.
`nK` | `int` |  |  | The number of keyframes to loop. Use 0 to loop all keyframes
`vAtTime` | `function` | <optional> | valueAtTime | A function to replace valueAtTime. Use this to loop after an expression+keyframe controlled animation, by providing a function used to generate the animation.
`damping` | `float` | <optional> | 0 | Exponentially attenuates the effect over time

View Source Duik_api_fordoc.jsxinc, line 26622

Requires:

- module:getPrevKey

Returns:
The new value
Type: `float`

#### # static "pointsToWorld"(points, layer) → {Array.<Array.<float>>}

Transform the points from layer to world coordinates

##### Parameters:

Name | Type | Description
--- | --- | ---
`points` | `Array.<Array.<float>>` | The points
`layer` | `Layer` | The layer

View Source Duik_api_fordoc.jsxinc, line 28072

Returns:
The points in world coordinates
Type: `Array.<Array.<float>>`

#### # static "shapePointsToLayer"(prop) → {Array.<Array.<float>>}

Gets the points of the shape path in layer coordinates (applies the group transform)

##### Parameters:

Name | Type | Description
--- | --- | ---
`prop` | `Property` | The property from which to get the path

View Source Duik_api_fordoc.jsxinc, line 28090

Requires:

- module:getGroupTransformMatrix

Returns:
The points in layer coordinates
Type: `Array.<Array.<float>>`

#### # static "subPath"(path1, path2, path2weight) → {Object}

Substracts two paths together.
The paths must be objects with three array attributes: points, inTangents, outTangents

##### Parameters:

Name | Type | Description
--- | --- | ---
`path1` | `Object` | First path
`path2` | `Object` | Second path
`path2weight` | `float` | A weight to multiply the second path values

View Source Duik_api_fordoc.jsxinc, line 27086

Requires:

- module:subPoints

Returns:
A path object with three array attributes: points, inTangents, outTangents
Type: `Object`

#### # static "subPoints"(p1, p2, w) → {Array.<Array.<float>>}

Substracts two lists of points/vectors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | `Array.<Array.<float>>` | The list of points
`p2` | `Array.<Array.<float>>` | The other list of points
`w` | `float` | A weight to multiply the values of p2

View Source Duik_api_fordoc.jsxinc, line 26968

Returns:
The substracted points
Type: `Array.<Array.<float>>`

#### # static "translatePointWithLayer"(l, pointopt, startTopt, endTopt) → {Array.<float>}

Translates a point with a layer, as if it was parented to it.
Note that for performance reasons with expressions, even if the parameters of the function are documented with optional/default values, you MUST provide ALL the arguments when using them.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`l` | `Layer` |  |  | The layer to get the translation from.
`point` | `Array.<float>` | <optional> | [0,0] | The [X,Y] point to translate (using world coordinates).
`startT` | `float` | <optional> | 0 | The start time of the translation
`endT` | `float` | <optional> | time | The end time of the translation

View Source Duik_api_fordoc.jsxinc, line 28113

Returns:
The coordinates of the translated point.
Type: `Array.<float>`

#### # static "zero"() → {any}

Generates a "zero" value for the current property, i.e. `0` or `[0,0]`, etc. according to the property type.
Note that for path properties, this method returns a path object with three array attributes: points, inTangents, outTangents.

View Source Duik_api_fordoc.jsxinc, line 27395

Returns:
The zero value.
Type: `any`

#### # static get(functions) → {string}

Gets functions and their dependencies from the library.

##### Parameters:

Name | Type | Description
--- | --- | ---
`functions` | `Array.<string>` | The name of the functions to get

View Source Duik_api_fordoc.jsxinc, line 25099

Returns:
The expression
Type: `string`

#### # static getRequirements(functionName) → {Array.<string>}

A recursive method to get all the requirements (dependencies) of a function from a library

##### Parameters:

Name | Type | Description
--- | --- | ---
`functionName` | `string` | The name of the function

View Source Duik_api_fordoc.jsxinc, line 25130

Returns:
The names of the required functions, including the querried one
Type: `Array.<string>`