Namespace

Library

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 DuAEF.jsxinc, line 24196

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 DuAEF.jsxinc, line 26386

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 DuAEF.jsxinc, line 25943

  • module:addPoints
A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25627

The added points
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 DuAEF.jsxinc, line 24801

the animated value.
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 DuAEF.jsxinc, line 24863

the value.
number

# 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 DuAEF.jsxinc, line 25317

  • module:getPrevKey
  • module:bezierInterpolation
The new value
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 DuAEF.jsxinc, line 26056

True when the property at propIndex is named propName
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 DuAEF.jsxinc, line 26080

True when the property at propIndex is named propName
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 DuAEF.jsxinc, line 25381

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25403

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25428

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25469

  • module:getPrevKey
The new value
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 DuAEF.jsxinc, line 26414

  • module:sign
The new rotation value, in degrees.
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 DuAEF.jsxinc, line 26446

The new scale value, in percent.
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 DuAEF.jsxinc, line 25675

The distance
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 DuAEF.jsxinc, line 24911

  • module:linearExtrapolation
the value.
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 DuAEF.jsxinc, line 26478

  • module:Matrix
  • module:getGroupTransformMatrix
The 2D coordinates of the point in the Layer.
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 DuAEF.jsxinc, line 26496

  • module:Matrix
  • module:getGroupTransformMatrix
The 2D coordinates of the point in the current group.
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 DuAEF.jsxinc, line 25701

The result
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 DuAEF.jsxinc, line 24943

the value.
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 DuAEF.jsxinc, line 24982

the value.
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 DuAEF.jsxinc, line 26513

The scale ratio. This is not a percent, 1.0 is 100%.
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 DuAEF.jsxinc, line 26103

The layer, or null if set to "None"
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 DuAEF.jsxinc, line 26534

  • module:isLayer
  • module:Matrix
The 2D Transform Matrix.
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 DuAEF.jsxinc, line 26568

The comp position
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 DuAEF.jsxinc, line 26589

  • module:getLayerWorldPos
The world position
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 DuAEF.jsxinc, line 26608

The world position
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 DuAEF.jsxinc, line 26627

  • module:getLayerWorldVelocity
A positive number. The speed.
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 DuAEF.jsxinc, line 26644

  • module:getLayerWorldPos
The velocity.
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 DuAEF.jsxinc, line 25182

The key, or null if there's no key before.
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 DuAEF.jsxinc, line 25205

  • module:isStill
  • module:getNextKey
The key, or null if there's no key before.
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 DuAEF.jsxinc, line 26659

  • module:sign
The orientation, in degrees.
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 DuAEF.jsxinc, line 26706

The orientation, in degrees.
float

# static "getPath"() → {Object}

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

View Source DuAEF.jsxinc, line 26117

A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25229

The key, or null if there's no key before.
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 DuAEF.jsxinc, line 25252

  • module:isStill
  • module:getPrevKey
The key, or null if there's no key before.
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 DuAEF.jsxinc, line 26136

The property.
Property

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

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

View Source DuAEF.jsxinc, line 26153

All indices to the property.
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 DuAEF.jsxinc, line 26728

  • module:getPropWorldVelocity
The world speed
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 DuAEF.jsxinc, line 26745

  • module:getLayerWorldPos
  • module:isPosition
The world coordinates
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 DuAEF.jsxinc, line 26765

  • module:getPropWorldValue
The world velocity
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 DuAEF.jsxinc, line 26181

  • module:getPropFromPath
  • module:getPropPath
The property.
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 DuAEF.jsxinc, line 26779

The scale, in percent.
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 DuAEF.jsxinc, line 25967

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
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 DuAEF.jsxinc, line 25006

# 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 DuAEF.jsxinc, line 25730

The two possible results, the lower is the first in the list. If both are the same, it is the maximum
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 DuAEF.jsxinc, line 25760

The result
Number

# static "isAfterLastKey"() → {boolean}

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

View Source DuAEF.jsxinc, line 25274

true if time is > lastkey.time
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 DuAEF.jsxinc, line 25291

true if the key is a maximum or minimum
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 DuAEF.jsxinc, line 26196

true if the prop is a layer
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 DuAEF.jsxinc, line 26809

  • module:sign
Whether the layer is flipped
bool

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

Checks if a property is a path property.
Parameters:
Name Type Description
prop Property The property

View Source DuAEF.jsxinc, line 26211

true if the property is a path property.
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 DuAEF.jsxinc, line 26231

true if the property is the transform.position property.
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 DuAEF.jsxinc, line 26245

true if the property is spatial.
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 DuAEF.jsxinc, line 26265

true if the property does not vary.
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 DuAEF.jsxinc, line 25780

true if all values are 0.
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 DuAEF.jsxinc, line 26291

  • module:getPrevKey
The last active time before t
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 DuAEF.jsxinc, line 25034

# 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 DuAEF.jsxinc, line 25097

the value.
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 DuAEF.jsxinc, line 25121

  • module:linearExtrapolation
the value.
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 DuAEF.jsxinc, line 25807

The result in the range [min, max] (excluding min and max)
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 DuAEF.jsxinc, line 25156

  • module:logistic
  • module:linearExtrapolation
the value.s
number

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

Returns the mean of a set of values
Parameters:
Name Type Description
values Array.<Number> The values

View Source DuAEF.jsxinc, line 25828

The mean
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 DuAEF.jsxinc, line 26004

  • module:multPoints
A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25850

The multiplied points
Array.<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 DuAEF.jsxinc, line 26315

  • module:getNextKey
The next active time after t
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 DuAEF.jsxinc, line 25869

The normalized weights
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 DuAEF.jsxinc, line 25509

  • module:getPrevKey
The new value
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 DuAEF.jsxinc, line 25546

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25588

  • module:getPrevKey
The new value
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 DuAEF.jsxinc, line 27015

The points in world coordinates
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 DuAEF.jsxinc, line 27033

  • module:getGroupTransformMatrix
The points in layer coordinates
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 DuAEF.jsxinc, line 26029

  • module:subPoints
A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25911

The substracted points
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 DuAEF.jsxinc, line 27056

The coordinates of the translated point.
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 DuAEF.jsxinc, line 26338

The zero value.
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 DuAEF.jsxinc, line 24203

The expression
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 DuAEF.jsxinc, line 24234

The names of the required functions, including the querried one
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 DuAEF.jsxinc, line 24277

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 DuAEF.jsxinc, line 26386

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 DuAEF.jsxinc, line 25943

  • module:addPoints
A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25627

The added points
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 DuAEF.jsxinc, line 24801

the animated value.
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 DuAEF.jsxinc, line 24863

the value.
number

# 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 DuAEF.jsxinc, line 25317

  • module:getPrevKey
  • module:bezierInterpolation
The new value
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 DuAEF.jsxinc, line 26056

True when the property at propIndex is named propName
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 DuAEF.jsxinc, line 26080

True when the property at propIndex is named propName
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 DuAEF.jsxinc, line 25381

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25403

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25428

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25469

  • module:getPrevKey
The new value
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 DuAEF.jsxinc, line 26414

  • module:sign
The new rotation value, in degrees.
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 DuAEF.jsxinc, line 26446

The new scale value, in percent.
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 DuAEF.jsxinc, line 25675

The distance
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 DuAEF.jsxinc, line 24911

  • module:linearExtrapolation
the value.
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 DuAEF.jsxinc, line 26478

  • module:Matrix
  • module:getGroupTransformMatrix
The 2D coordinates of the point in the Layer.
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 DuAEF.jsxinc, line 26496

  • module:Matrix
  • module:getGroupTransformMatrix
The 2D coordinates of the point in the current group.
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 DuAEF.jsxinc, line 25701

The result
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 DuAEF.jsxinc, line 24943

the value.
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 DuAEF.jsxinc, line 24982

the value.
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 DuAEF.jsxinc, line 26513

The scale ratio. This is not a percent, 1.0 is 100%.
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 DuAEF.jsxinc, line 26103

The layer, or null if set to "None"
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 DuAEF.jsxinc, line 26534

  • module:isLayer
  • module:Matrix
The 2D Transform Matrix.
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 DuAEF.jsxinc, line 26568

The comp position
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 DuAEF.jsxinc, line 26589

  • module:getLayerWorldPos
The world position
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 DuAEF.jsxinc, line 26608

The world position
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 DuAEF.jsxinc, line 26627

  • module:getLayerWorldVelocity
A positive number. The speed.
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 DuAEF.jsxinc, line 26644

  • module:getLayerWorldPos
The velocity.
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 DuAEF.jsxinc, line 25182

The key, or null if there's no key before.
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 DuAEF.jsxinc, line 25205

  • module:isStill
  • module:getNextKey
The key, or null if there's no key before.
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 DuAEF.jsxinc, line 26659

  • module:sign
The orientation, in degrees.
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 DuAEF.jsxinc, line 26706

The orientation, in degrees.
float

# static "getPath"() → {Object}

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

View Source DuAEF.jsxinc, line 26117

A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25229

The key, or null if there's no key before.
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 DuAEF.jsxinc, line 25252

  • module:isStill
  • module:getPrevKey
The key, or null if there's no key before.
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 DuAEF.jsxinc, line 26136

The property.
Property

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

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

View Source DuAEF.jsxinc, line 26153

All indices to the property.
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 DuAEF.jsxinc, line 26728

  • module:getPropWorldVelocity
The world speed
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 DuAEF.jsxinc, line 26745

  • module:getLayerWorldPos
  • module:isPosition
The world coordinates
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 DuAEF.jsxinc, line 26765

  • module:getPropWorldValue
The world velocity
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 DuAEF.jsxinc, line 26181

  • module:getPropFromPath
  • module:getPropPath
The property.
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 DuAEF.jsxinc, line 26779

The scale, in percent.
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 DuAEF.jsxinc, line 25967

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
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 DuAEF.jsxinc, line 25006

# 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 DuAEF.jsxinc, line 25730

The two possible results, the lower is the first in the list. If both are the same, it is the maximum
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 DuAEF.jsxinc, line 25760

The result
Number

# static "isAfterLastKey"() → {boolean}

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

View Source DuAEF.jsxinc, line 25274

true if time is > lastkey.time
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 DuAEF.jsxinc, line 25291

true if the key is a maximum or minimum
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 DuAEF.jsxinc, line 26196

true if the prop is a layer
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 DuAEF.jsxinc, line 26809

  • module:sign
Whether the layer is flipped
bool

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

Checks if a property is a path property.
Parameters:
Name Type Description
prop Property The property

View Source DuAEF.jsxinc, line 26211

true if the property is a path property.
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 DuAEF.jsxinc, line 26231

true if the property is the transform.position property.
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 DuAEF.jsxinc, line 26245

true if the property is spatial.
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 DuAEF.jsxinc, line 26265

true if the property does not vary.
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 DuAEF.jsxinc, line 25780

true if all values are 0.
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 DuAEF.jsxinc, line 26291

  • module:getPrevKey
The last active time before t
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 DuAEF.jsxinc, line 25034

# 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 DuAEF.jsxinc, line 25097

the value.
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 DuAEF.jsxinc, line 25121

  • module:linearExtrapolation
the value.
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 DuAEF.jsxinc, line 25807

The result in the range [min, max] (excluding min and max)
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 DuAEF.jsxinc, line 25156

  • module:logistic
  • module:linearExtrapolation
the value.s
number

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

Returns the mean of a set of values
Parameters:
Name Type Description
values Array.<Number> The values

View Source DuAEF.jsxinc, line 25828

The mean
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 DuAEF.jsxinc, line 26004

  • module:multPoints
A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25850

The multiplied points
Array.<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 DuAEF.jsxinc, line 26315

  • module:getNextKey
The next active time after t
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 DuAEF.jsxinc, line 25869

The normalized weights
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 DuAEF.jsxinc, line 25509

  • module:getPrevKey
The new value
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 DuAEF.jsxinc, line 25546

  • module:getNextKey
The new value
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 DuAEF.jsxinc, line 25588

  • module:getPrevKey
The new value
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 DuAEF.jsxinc, line 27015

The points in world coordinates
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 DuAEF.jsxinc, line 27033

  • module:getGroupTransformMatrix
The points in layer coordinates
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 DuAEF.jsxinc, line 26029

  • module:subPoints
A path object with three array attributes: points, inTangents, outTangents
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 DuAEF.jsxinc, line 25911

The substracted points
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 DuAEF.jsxinc, line 27056

The coordinates of the translated point.
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 DuAEF.jsxinc, line 26338

The zero value.
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 DuAEF.jsxinc, line 24203

The expression
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 DuAEF.jsxinc, line 24234

The names of the required functions, including the querried one
Array.<string>