After Effects properties methods
Namespaces
Methods
-
static addKey(props, typeIn, typeOutopt, easeInValueopt, easeOutValueopt, timeopt)
-
Adds a new keyframe on the properties.
To set a value of your choice on one property,
you can create a newKeyFrame
, then useDuAEF.DuAE.Property.setKey
.Parameters:
Name Type Attributes Default Description props
Array.<PropertyBase> | Array.<PropertyInfo> The properties typeIn
KeyframeInterpolationType | string The in interpolation type (see AE API) or the string "roving" or "continuous" typeOut
KeyframeInterpolationType | string <optional>
typeIn The out interpolation type (see AE API) easeInValue
Array.<int> | int <optional>
33 The in interpolation ease value (used if typeIn is KeyframeInterpolationType.BEZIER) easeOutValue
Array.<int> | int <optional>
easeInValue The out interpolation ease value (used if typeOut is KeyframeInterpolationType.BEZIER) time
float <optional>
comp.time The time at which to add the key -
static addToEGP(prop) → {int}
-
Adds all the (supported) properties found in a property to the essential graphics panel
Note: any Property or PropertyGroup (and its subproperties) named "data" will be ignored.Parameters:
Name Type Description prop
PropertyBase The property Returns:
int - The number of properties added -
static cleanKeyframes(property)
-
Removes all unneeded keyframes from the property.< br/> Also checks the interpolation values to reset the correct display as linear/smooth.
Parameters:
Name Type Description property
Property | PropertyInfo The property -
static firstKeyFrameTime(props, selected) → {float|null}
-
Gets the time of the first keyFrame
Parameters:
Name Type Description props
Array.<PropertyBase> | Array.<PropertyInfo> The properties selected
boolean true to check selected keyframes only Returns:
float | null - The keyframe time or null if there are no keyframe -
static fixSpatialInterpolation(prop)
-
Fixes the spatial interpolation of the selected keys.
Sets the interpolation to linear when the property does not move between keyframesParameters:
Name Type Description prop
Property | PropertyInfo The property -
static getAnim(prop, selectedopt, timeRangeopt) → {PropertyGroupAnim|PropertyAnim}
-
Gets all animations in the group in the whole timeline or in the time range
The first KeyFrame._time will be adjusted relatively to the start of the time range (if provided) instead of the startTime of the composition.Parameters:
Name Type Attributes Default Description prop
PropertyGroup | PropertyInfo The property. selected
boolean <optional>
false true to get only selected keyframes. timeRange
Array.<float> <optional>
The time range, an array of two time values, in seconds. If not provided, will use the comp time range. Returns:
PropertyGroupAnim | PropertyAnim - The animations. A PropertyAnim if prop is a Property, a PopertyGroupAnim if it is a PropertyGroup -
static getAnimatedProps(prop, filteropt, strictopt, caseSensitiveopt) → {Array.<PropertyInfo>}
-
Gets the After Effects animated (with keyframes) properties in the propertyGroup
Parameters:
Name Type Attributes Default Description prop
PropertyGroup The parent propertyGroup where to search for animations filter
PropertyType | PropertyValueType | string | function <optional>
A filter to get only a certain type, or value type, or property name or matchName.
A function which take one PropertyBase as argument can be used to filter the properties: the Property will be returned if the function returns true.strict
boolean <optional>
false If a string filter is provided, wether to search for the exact name/matchName or if it contains the filter. caseSensitive
boolean <optional>
true If a string filter is provided, and not strict is false, does the search have to be case sensitive? Returns:
Array.<PropertyInfo> - The selected properties, an empty Array if nothing active or selected -
static getAverageSpeed(props, preExpressionopt, fastModeopt) → {float}
-
Gets the average speed of the animated propreties
Parameters:
Name Type Attributes Default Description props
Array.<Property> | Array.<PropertyInfo> The Properties preExpression
bool <optional>
true True to get the velocity from keyframes instead of the result of the exression fastMode
bool <optional>
true True to limit the number of samples used to compute the velocity and make the process faster. Returns:
float - The average speed in unit per second -
static getComp(prop) → {CompItem}
-
Gets the composition containing the property
Parameters:
Name Type Description prop
PropertyBase | PropertyInfo The After Effects Property Returns:
CompItem - The composition -
static getDimensions(prop) → {int}
-
Gets the number of dimensions of a property
Parameters:
Name Type Description prop
Property | PropertyInfo The After Effects Property Returns:
int - The number of dimensions, 0 if this is not a dimensionnal value (ie color, text, shape...) -
static getExpressionLink(prop, useThisCompopt, fromLayeropt) → {str}
-
Gets an expression link to the property
Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property useThisComp
bool <optional>
false Wether to begin the expression by 'thisComp' or 'comp("name")' fromLayer
bool <optional>
true Wether to begin the expression by comp.layer or directly from the first prop of the layer Returns:
str - The expression link to the property -
static getKeyFrameAtIndex(prop, keyIndex) → {KeyFrame}
-
Gets the key at a given index on a property
Parameters:
Name Type Description prop
Property | PropertyInfo The property. keyIndex
int The index of the key to retrieve. If the index is negative, it is counted from the end i.e. to retrieve the keyframe before the last one, use -2 (-1 is the last) Returns:
KeyFrame - The keyframe, or null if incorrect index -
static getKeyFrameAtTime(prop, time) → {KeyFrame}
-
Gets the key at an exactly given time on a property
Parameters:
Name Type Description prop
Property | PropertyInfo The property. time
float The time of the key to retrieve. Returns:
KeyFrame - The keyframe, or null if incorrect time -
static getKeyFrames(prop, selectedopt, timeRangeopt) → {Array.<KeyFrame>}
-
Gets the property keyframes in the whole timeline or in the time range
The KeyFrame._time will be adjusted relatively to the start of the time range instead of the startTime of the composition.Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property. selected
boolean <optional>
false true to get only selected keyframes. timeRange
Array.<float> <optional>
The time range, an array of two time values, in seconds. If not provided, will use the comp time range.
Ignored if selected is true;Returns:
Array.<KeyFrame> - The keyframes, or null of this property is of type PropertyValueType.NO_VALUE or PropertyValueType.CUSTOM_VALUE -
static getLayer(prop) → {Layer}
-
Gets the layer containing the property
Parameters:
Name Type Description prop
PropertyBase | PropertyInfo The After Effects Property Returns:
Layer - The layer -
static getMaximumSpeed(props, preExpressionopt) → {float}
-
Gets the maximum speed of the animated propreties
Parameters:
Name Type Attributes Default Description props
Array.<Property> | Array.<PropertyInfo> The Properties preExpression
bool <optional>
true True to get the velocity from keyframes instead of the result of the exression Returns:
float - The average speed -
static getMaxVelocity(prop, preExpressionopt, fastModeopt) → {float}
-
Gets the maximum velocity of the animated property.
The property type must be one of: one D, two D, three D (spatial or not), Color. If the property is not one of these types, returns 0.Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property preExpression
bool <optional>
true True to get the velocity from keyframes instead of the result of the exression fastMode
bool <optional>
true True to limit the number of samples used to compute the velocity and make the process faster.
The number of samples is automatically adapted from the duration of the composition.
When true and if there are more than one keyframe, the velocity is sampled only between keyframes.Returns:
float - The velocity. -
static getNearestKeyFrameAtTime(prop, time) → {KeyFrame}
-
Gets the nearest key at a given time on a property
Parameters:
Name Type Description prop
Property | PropertyInfo The property. time
float The time of the key to retrieve. Returns:
KeyFrame - The keyframe, or null if incorrect time or not found -
static getProps(property, filteropt, strictopt, caseSensitiveopt) → {Array.<PropertyInfo>}
-
Gets the After Effects properties in the property
Parameters:
Name Type Attributes Default Description property
PropertyBase | PropertyInfo The layer filter
PropertyType | PropertyValueType | string | function <optional>
A filter to get only a certain type, or value type, or property name or matchName.
A function which take one PropertyBase as argument can be used to filter the properties: the Property will be returned if the function returns true.strict
boolean <optional>
false If a string filter is provided, wether to search for the exact name/matchName or if it contains the filter. caseSensitive
boolean <optional>
true If a string filter is provided, and not strict is false, does the search have to be case sensitive? Returns:
Array.<PropertyInfo> - The selected properties, an empty Array if nothing found -
static getRange(prop, axisopt, preExpressionopt, fastModeopt) → {Array.<float>}
-
Gets the value range of the animated property.
The property type must be one of: one D, two D, three D (spatial or not), Color. If the property is not one of these types, returns an empty Array.Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property axis
int <optional>
0 The axis (or the color channel) to get the range preExpression
bool <optional>
true True to get the range from keyframes instead of the result of the exression fastMode
bool <optional>
true True to check the range with values only at keyframe times. False to check the range with all values, at each frame of the comp. Returns:
Array.<float> - The minimum and maximum value.
The first item in the Array is not necesarily the lowest value, it is the first in time. -
static getSpeed(prop, timeopt, preExpressionopt) → {float}
-
Gets the speed of a property at a given time
Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property time
float <optional>
composition.time The time. preExpression
boolean <optional>
true true to get the pre-expression speed. Returns:
float - The speed -
static hasSelectedKeys(prop) → {boolean}
-
Checks if the property has some selected keyframes.
The property can be either a Property or a PropertyGroup.Parameters:
Name Type Description prop
PropertyBase The property Returns:
boolean - true if the property have at least one selected keyframe -
static isAnimated(prop) → {boolean}
-
Checks if the property has an animation (keyframes)
Parameters:
Name Type Description prop
Property The property Returns:
boolean - True if the property is animated -
static isEditable(prop) → {bool}
-
Checks if this property value can be edited
Parameters:
Name Type Description prop
Property | PropertyInfo The After Effects Property Returns:
bool - true if the value of the property can be edited, false otherwise -
static isMasterProperty(prop) → {bool}
-
Checks if a property is part of the master properties of a precomp
Parameters:
Name Type Description prop
Property | PropertyInfo The After Effects Property Returns:
bool - true if property is part of the master properties -
static isNumerical(prop) → {bool}
-
Checks if the property value is a number or an Array of Number.
I.e if its value type is one of: one D, two D, three D (spatial or not), Color.Parameters:
Name Type Description prop
Property The property Returns:
bool -
static isRiggable(prop) → {bool}
-
Checks if this property value can be rigged (with an expression)
Parameters:
Name Type Description prop
Property | PropertyInfo The After Effects Property Returns:
bool - true if the value of the property can be rigged, false otherwise -
static linkProperties(childProp, parentProp, useThisCompopt, timeLayeropt)
-
Link all the properties found in childProp to all the same properties of parentProp (this is a recursive method)
Note: any Property or PropertyGroup (and its subproperties) named "Data" will be linked the opposite way (from parentProp to childProp).Parameters:
Name Type Attributes Default Description childProp
PropertyBase The child property parentProp
PropertyBase The parent property useThisComp
bool <optional>
Wether to begin the expression by 'thisComp' or 'comp("name")', default: will detect if the properties are in the same comp timeLayer
LayerItem <optional>
null A layer used to offset the time (typically, in case of link between precompositions, the precomposition layer).
When not null, the start time of this layer will be taken into account to get the values and synchronize them. -
static lock(properties)
-
Locks the property with an expression so its value cannot be changed
Parameters:
Name Type Description properties
PropertyBase | PropertyInfo | Array.<PropertyBase> | Array.<PropertyInfo> The property or properties -
static newUniqueMarkerName(newName, prop, incrementopt) → {string}
-
Generates a new unique name for a marker for this marker porperty
Parameters:
Name Type Attributes Default Description newName
string The wanted new name prop
Property The comp increment
boolean <optional>
true true to automatically increment the new name if it already ends with a digit Returns:
string - The unique name, with a new number at the end if needed. -
static pickWhip(childProp, parentProp, useThisComp)
-
Adds an expression to the child property, linking it to the parent property
Parameters:
Name Type Description childProp
Property The child property (the one which gets an expression). parentProp
Property The parent property. useThisComp
bool Wether to begin the expression by 'thisComp' or 'comp("name")', default: will detect if the properties are in the same comp -
static removeAnim(prop, removeExpressionopt)
-
Removes the animation from the property
Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property removeExpression
boolean <optional>
false Set to true to remove the expression too -
static removeDataExpressions(prop)
-
Removes all expressions found in groups or sections named "Data" in the property.
Parameters:
Name Type Description prop
PropertyBase The property -
static removeExpression(prop, filter, keepPostExpressionValueopt)
-
Removes the expression from the property, keeping the post-expression value.
Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property filter
function A function which takes a string as a parameter (the expression). Returns true if the expression has to be removed. keepPostExpressionValue
bool <optional>
true Set to false to just remove the expressions and get back the pre expression value -
static removeExpressions(prop, filter, keepPostExpressionValueopt)
-
Removes all expressions found in the property.
Parameters:
Name Type Attributes Default Description prop
PropertyBase The property filter
function A function which takes a string as a parameter (the expression). Returns true if the expression has to be removed. keepPostExpressionValue
bool <optional>
true Set to false to just remove the expressions and get back the pre expression value -
static replaceInExpressions(prop, oldString, newString, caseSensitiveopt)
-
Replaces text in Expressions
Parameters:
Name Type Attributes Default Description prop
PropertyBase | PropertyInfo The property (can be a group) oldString
string The string to replace newString
string The new string caseSensitive
boolean <optional>
true Wether the search has to be case sensitive -
static scriptifyExpression(prop, varNameopt) → {string}
-
Converts the expression as a string which can be copy/pasted and included in a script.
Parameters:
Name Type Attributes Description prop
Property | PropertyInfo | string The property containing the expression or the expression itself. varName
string <optional>
A name for the variable Returns:
string - The stringified expression. -
static selectKeyFrames(property, inTimeopt, outTimeopt)
-
Selects the keyframes in the propoerty.
Selects all nested keyframes if the property is a group.Parameters:
Name Type Attributes Default Description property
PropertyBase | PropertyInfo The property inTime
float <optional>
0 The time at which to select the keyframes outTime
float <optional>
inTime The end time -
static setAnim(prop, anims, timeopt, setExpressionopt, replaceopt, offsetopt) → {boolean}
-
Sets the property animation on the property.
Use this method only to force the animation onto the property without checks.
Must be used on a Property (not a group) with a PropertyAnim (not a PropertyGroupAnim).
To easily set an animation on a property with automatic compatibility checks, you should use setGroupAnim().Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property. anims
PropertyAnim The animation time
float <optional>
comp.time The time where to begin the animation setExpression
boolean <optional>
false Sets the expression too replace
boolean <optional>
false true to remove any existing keyframe on the properties before adding new keyframes offset
boolean <optional>
false true to offset the current value, instead of replacing it Returns:
boolean - true if the anim was actually set. -
static setEase(props, easeInValueopt, easeOutValueopt, velocityInValueopt, velocityOutValueopt, velocityAsPercentopt)
-
Changes the ease influences of the selected keys
Parameters:
Name Type Attributes Default Description props
Array.<PropertyBase> | Array.<PropertyInfo> The properties easeInValue
Array.<int> | int <optional>
The in interpolation ease value. Will be ignored if undefined. easeOutValue
Array.<int> | int <optional>
The out interpolation ease value. Will be ignored if undefined. velocityInValue
Array.<int> | int <optional>
The out interpolation ease value. Will be ignored if undefined. velocityOutValue
Array.<int> | int <optional>
The out interpolation ease value. Will be ignored if undefined. velocityAsPercent
boolean <optional>
false Use a percent instead of a value to set velocities.
In this case, the proper velocity value will be deduced by multiplying the max speed of the property by the percent. -
static setExpression(property, expr, keepValueopt)
-
Sets an expression to a property.
With the ability to keep the initial value.Parameters:
Name Type Attributes Default Description property
Property | PropertyInfo The property expr
string The expression keepValue
bool <optional>
true When true, the method will try to keep the same resulting value as before applying the expression. -
static setGroupAnim(prop, anims, timeopt, ignoreNameopt, setExpressionopt, onlyKeyframesopt, replaceopt, whiteListopt, offsetopt) → {boolean}
-
Sets all animations on a Property or a PropertyGroup.
Parameters:
Name Type Attributes Default Description prop
PropertyGroup | PropertyInfo The property group. anims
PropertyAnim The animation time
float <optional>
comp.time The time where to begin the animation ignoreName
boolean <optional>
false true to set the anim even if name of the property do not match the animation. setExpression
boolean <optional>
false Sets the expression too onlyKeyframes
boolean <optional>
true If false, the value of properties without keyframes will be set too. replace
boolean <optional>
false true to remove any existing keyframe on the properties before adding new keyframes whiteList
Array.<string> <optional>
A list of matchNames used as a white list for properties to set anims.
Can be the matchName of a propertyGroup to set all the subproperties.
Ignored if the list is empty.offset
boolean <optional>
false true to offset the current value, instead of replacing it Returns:
boolean - true if the anim was actually set. -
static setInterpolationType(layers, props, typeIn, typeOutopt, easeInValueopt, easeOutValueopt)
-
Changes the interpolation type on selected keyframes, or sets a new key at current time if there are no keyframes selected.
Parameters:
Name Type Attributes Default Description layers
Array.<Layer> | LayerCollection The layers containing the properties props
Array.<PropertyBase> | Array.<PropertyInfo> The properties typeIn
KeyframeInterpolationType | string The in interpolation type (see AE API) or the string "roving" or "continuous" typeOut
KeyframeInterpolationType | string <optional>
typeIn The out interpolation type (see AE API) easeInValue
Array.<int> | int <optional>
33 The in interpolation ease value (used if typeIn is KeyframeInterpolationType.BEZIER) easeOutValue
Array.<int> | int <optional>
easeInValue The out interpolation ease value (used if typeOut is KeyframeInterpolationType.BEZIER) -
static setKey(prop, key, timeOffsetopt)
-
Sets a
KeyFrame
on a propertyParameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property. key
KeyFrame The KeyFrame. timeOffset
float <optional>
comp.time The time offset (added to KeyFrame._time) where to add the key frame. -
static setKeyInterpolation(prop, key, typeIn, typeOutopt, easeInValueopt, easeOutValueopt)
-
Sets interpolations on a keyframe.
Parameters:
Name Type Attributes Default Description prop
Property The property key
int The key index typeIn
KeyframeInterpolationType | string The in interpolation type (see AE API) or the string "roving" or "continuous" typeOut
KeyframeInterpolationType | string <optional>
typeIn The out interpolation type (see AE API) easeInValue
Array.<int> | int <optional>
33 The in interpolation ease value (used if typeIn is KeyframeInterpolationType.BEZIER) easeOutValue
Array.<int> | int <optional>
easeInValue The out interpolation ease value (used if typeOut is KeyframeInterpolationType.BEZIER) -
static setSpatialInterpolation(prop, typeIn, typeOutopt)
-
Sets the spatial interpolation of the selected keyframes on the property
Parameters:
Name Type Attributes Default Description prop
Property | PropertyInfo The property typeIn
KeyframeInterpolationType The in interpolation type (see AE API) typeOut
KeyframeInterpolationType <optional>
typeIn The in interpolation type (see AE API) -
static setValue(prop, value, defaultTime) → {boolean}
-
Sets a value on a property, adjusting the dimensions if needed
Parameters:
Name Type Description prop
Property | PropertyInfo The property value
any The value to set defaultTime
float The time at which to set the value if the property has keyframes Returns:
boolean - True if the value has correctly been set, false otherwise. -
static setValueAtTime(prop, value, timeopt) → {boolean}
-
Sets a new keyframe on a property, adjusting the dimensions if needed, at desired time
Parameters:
Name Type Attributes Description prop
Property | PropertyInfo The property value
any The value to set time
float <optional>
The time of the new keyframe Returns:
boolean - True if the value has correctly been set, false otherwise. -
static velocityToPercent(prop, key) → {Array.<float>}
-
Computes a percentage from a velocity on a given keyframe.
Parameters:
Name Type Description prop
Property | PropertyInfo The property key
int The index of the keyframe where to compute the velocity Returns:
Array.<float> - The velocities [in, out] as a percentage.