Property object

app.project.item(index).layer(index).propertySpec

Description

The Property object contains value, keyframe, and expression information about a particular AE property of a layer. An AE property is an value, often animatable, of an effect, mask, or transform within an individual layer. For examples of how to access properties, see PropertyBase object” and “PropertyGroup property() method”.

• Property is a subclass of PropertyBase. All methods and attributes of PropertyBase, in addition to those listed below, are available when working with Property.
NOTE: JavaScript objects commonly referred to as “properties” are called “attributes” in this guide, to avoid confusion with the After Effects definition of property.

Attributes

Attribute Reference Description
propertyValueTyp e “Property propertyValueType attribute” Type of value stored in this property.
value “Property value attribute” Current value of the property.
hasMin “Property hasMin attribute” When true, there is a minimum permitted value.
hasMax “Property hasMax attribute” When true, there is a maximum permitted value.
minValue “Property minValue attribute” The minimum permitted value.
maxValue “Property maxValue attribute” The maximum permitted value.
isSpatial “Property isSpatial attribute” When true, the property defines a spatial value.
canVaryOverTime “Property canVaryOverTime attribute” When true, the property can be keyframed.
isTimeVarying “Property isTimeVarying attribute” When true, the property has keyframes or an expression enabled that can vary its values.
numKeys “Property numKeys attribute” The number of keyframes on this property.
unitsText “Property unitsText attribute” A text description of the units in which the value is expressed.
expression “Property expression attribute” The expression string for this property.
canSetExpression “Property canSetExpression attribute” When true, the expression can be set by a script.
expressionEnabled “Property expressionEnabled attribute” When true, the expression is used to generate values for the property.
expressionError “Property expressionError attribute” The error, if any, that occurred when the last expression was evaluated.
Attribute Reference Description selectedKeys “Property selectedKeys attribute” All selected keyframes of the property.
propertyIndex “Property propertyIndex attribute” The position index of this property.
dimensionsSeparated “Property dimensionsSeparated attribute” When true, the property’s dimensions are represented as separate properties.
isSeparationFollower “Property isSeparationFollower attribute” When true, the property represents one of the separated dimensions for a multidimensional property.
isSeparationLeader “Property isSeparationLeader attribute” When true, the property is multidimensional and can be separated.
separationDimension “Property separationDimension attribute” For a separated follower, the dimension it represents in the multidimensional leader.
separationLeader “Property separationLeader attribute” The original multidimensional property for this separated follower.

Methods

Method Reference Description
valueAtTime() “Property valueAtTime() method” Gets the value of the property evaluated at given time.
setValue() “Property setValue() method” Sets the static value of the property.
setValueAtTime() “Property setValueAtTime() method” Creates a keyframe for the property.
setValuesAtTimes() “Property setValuesAtTimes() method” Creates a set of keyframes for the property.
setValueAtKey() “Property setValueAtKey() method” Finds a keyframe and sets the value of the property at that keyframe.
nearestKeyIndex() “Property nearestKeyIndex() method” Gets the keyframe nearest to a specified time.
keyTime() “Property keyTime() method” Gets the time at which a condition occurs.
keyValue() “Property keyValue() method” Gets the value of a keyframe at the time at which a condition occurs.
addKey() “Property addKey() method” Adds a new keyframe to the property at a given time.
removeKey() “Property removeKey() method” Removes a keyframe from the property.
isInterpolationTypeValid() “Property isInterpolationTypeValid() method” When true, this property can be interpolated.
setInterpolationTypeAtKey() “Property setInterpolationTypeAtKey() method”Sets the interpolation type for a key.
keyInInterpolationType() “Property keyInInterpolationType() method” Gets the ‘in’ interpolation type for a key.
keyOutInterpolationType() “Property keyOutInterpolationType() method” Gets the ‘out’ interpolation type for a key.
Method Reference Description
setSpatialTangentsAtKey() “Property setSpatialTangentsAtKey() method” Sets the “in” and “out” tangent vectors for a key.
keyInSpatialTangent() “Property keyInSpatialTangent() method” Gets the “in” spatial tangent for a key.
keyOutSpatialTangent() “Property keyOutSpatialTangent() method” Gets the “out” spatial tangent for a key.
setTemporalEaseAtKey() “Property setTemporalEaseAtKey() method” Sets the “in” and “out” temporal ease for a key.
keyInTemporalEase() “Property keyInTemporalEase() method” Gets the “in” temporal ease for a key.
keyOutTemporalEase() “Property keyOutTemporalEase() method” Gets the “out” temporal ease for a key.
setTemporalContinuousAtKey() “Property setTemporalContinuousAtKey() method” Sets whether a keyframe has temporal continuity.
keyTemporalContinuous() “Property keyTemporalContinuous() method” Reports whether a keyframe has temporal continuity.
setTemporalAutoBezierAtKey() “Property setTemporalAutoBezierAtKey() method” Sets whether a keyframe has temporal auto-Bezier.
keyTemporalAutoBezier() “Property keyTemporalAutoBezier() method” Reports whether a keyframe has temporal auto-Bezier.
setSpatialContinuousAtKey() “Property setSpatialContinuousAtKey() method” Sets whether a keyframe has spatial continuity.
keySpatialContinuous() “Property keySpatialContinuous() method” Reports whether a keyframe has spatial continuity.
setSpatialAutoBezierAtKey “Property setSpatialAutoBezierAtKey() method” Sets whether a keyframe has spatial auto-Bezier.
keySpatialAutoBezier() “Property keySpatialAutoBezier() method” Reports whether a keyframe has spatial auto-Bezier.
setRovingAtKey() “Property setRovingAtKey() method” Sets whether a keyframe is roving.
keyRoving() “Property keyRoving() method” Reports whether a keyframe is roving.
setSelectedAtKey() “Property setSelectedAtKey() method” Sets whether a keyframe is selected.
keySelected() “Property keySelected() method” Reports whether a keyframe is selected.
getSeparationFollower() “Property getSeparationFollower() method” For a separated, multidimensional property, retrieves a specific follower property.

Example: Get and set the value of opacity
var myProperty = myLayer.opacity;
//opacity has propertyValueType of OneD, and is stored as a float
myProperty.setValue(50); // set opacity to 50%
// Variable myOpacity is a float value
var myOpacity = myProperty.value;

Example: Get and set the value of a position
var myProperty = myLayer.position;
//position has propertyValueType of ThreeD_SPATIAL, and is stored as an array of 3 floats
myProperty.setValue([10.0, 30.0, 0.0]);
// Variable myPosition is an array of 3 floats
var myPosition = myProperty.value;

Example: Change the value of a mask shape to be open instead of closed
var myMask = mylayer.mask(1);
var myProperty = myMask.maskPath;
myShape = myProperty.value;
myShape.closed = false;
myProperty.setValue(myShape);

Example: Get the value of a color at a particular time

A color is stored as an array of four floats, [r,g,b,opacity]. This sets the value of the red component of a light’s color at time 4 to be half of that at time 2:
var myProperty = myLight.color;
var colorValue = myProperty.valueAtTime(2,true);
colorValue[0] = 0.5 * colorValue[0];
myProperty.setValueAtTime(4,colorValue);

Example: Check that a scale calculated by an expression at time 3.5 is the expected value of [10,50]
var myProperty = myLayer.scale;
// false value of preExpression means evaluate the expression
var scaleValue = myProperty.valueAtTime(3.5,false);
if (scaleValue[0] == 10 && scaleValue[1] == 50) {

alert("hurray");
}
else {
alert("oops");
}

Example: Keyframe a rotation from 0 to 90 and back again

The animation is 10 seconds, and the middle keyframe is at the 5 second mark. Rotation properties are stored as a OneD value.
myProperty = myLayer.rotation;
myProperty.setValueAtTime(0, 0);
myProperty.setValueAtTime(5, 90);
myProperty.setValueAtTime(10, 0);

Example: Change the keyframe values for the first three keyframes of some source text
myProperty = myTextLayer.sourceText;

if (myProperty.numKeys "< 3) { alert("error, I thought there were 3 keyframes"); } else { myProperty.setValueAtKey(1, new TextDocument("key number 1")); myProperty.setValueAtKey(2, new TextDocument("key number 2")); myProperty.setValueAtKey(3, new TextDocument("key number 3")); }
Example: Set values using the convenience syntax for position, scale, color, or source text
// These two are equivalent. The second fills in a default of 0.
myLayer.position.setValue([20, 30, 0]);
myLayer.position.setValue([20, 30]);
// These two are equivalent. The second fills in a default of 100.
myLayer.scale.setValue([50, 50, 100]);
myLayer.scale.setValue([50, 50]);
// These two are equivalent. The second fills in a default of 1.0
myLight.color.setValue([.8, .3, .1, 1.0]);
myLight.color.setValue([.8, .3, .1]);
// These two are equivalent. The second creates a TextDocument
myTextLayer.sourceText.setValue(new TextDocument("foo"));
myTextLayer.sourceText.setValue("foo")
;

Other Tags

Posted in Property object and tagged , , , , , , , , , , , , , , , , , , .