global
Global
Section titled “Global”These attributes and methods are global, top-level elements accessible from any expression across your project. They’re among the most commonly-used expression elements.
Attributes
Section titled “Attributes”colorDepth
Section titled “colorDepth”colorDepth
Description
Section titled “Description”Type the project color depth value.
For example, colorDepth
returns 16
when the project color depth is 16 bits per channel.
Number
thisComp
Section titled “thisComp”thisComp
Description
Section titled “Description”Represents the composition containing the expression.
thisLayer
Section titled “thisLayer”thisLayer
Description
Section titled “Description”Represents the layer containing the expression.
Because thisLayer
is the default object, its use is optional.
For example, you can start an expression with thisLayer.width
or width
and get the same result.
Layer, Light, or Camera object
thisProject
Section titled “thisProject”thisProject
Description
Section titled “Description”Represents the project which contains the expression.
thisProperty
Section titled “thisProperty”thisProperty
Description
Section titled “Description”Represents the property containing the expression.
For example, if you write an expression on the Rotation property, you can start an expression with thisProperty
to refer to the Rotation property.
time
Description
Section titled “Description”Represents the composition time, in seconds, at which the expression is being evaluated.
Number
value
Description
Section titled “Description”Represents the value at the current time for the property containing the expression.
A value of the same property type as the property being refrenced.
Methods
Section titled “Methods”comp()
Section titled “comp()”comp(name)
Description
Section titled “Description”Retrieves another composition by name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | The name of the composition to get |
Returns
Section titled “Returns”footage()
Section titled “footage()”footage(name)
Description
Section titled “Description”Retrieves a footage item by name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | The name of the footage item to get |
Returns
Section titled “Returns”posterizeTime()
Section titled “posterizeTime()”posterizeTime(updatesPerSecond)
Description
Section titled “Description”This expression allows you to set the frame rate for a property to be lower than the frame rate of the composition.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
updatesPerSecond | Number | The number of times per second the expression should evaluate |
Returns
Section titled “Returns”Number
Example
Section titled “Example”To change a property to a random value 1 time per second:
posterizeTime(1);
random()
To change a 2d property (such as Position or Scale) to a random value 3 times per second:
posterizeTime(3);
const newValue = random(0, 100);[newValue, newValue];
To change a property to a random value within a specified range, every 12 frames:
const holdFrames = 12;const minValue = 50;const maxValue = 100;
posterizeTime(1 / framesToTime(holdFrames));
const newValue = random(minValue, maxValue);newValue;