I’m Ayana, a Vtuber!
Today, I will explain how to use expression!
Expression is a programming language unique to After Effects that allows you to create animation and randomize objects without using keyframes.
Here I will explain how to create a simple script and how to link properties with other layers!
- Notes for Expression Description
- Write Script for Expression
- Link Expression with other properties
Notes for Expression Description
The expression must be dimensioned. In the case of 1D, only one value is sufficient, but in the case of 2D, you need to define the X-axis and Y-axis values, and in the case of 3D, you need to define the X-axis, Y-axis, and Z-axis values.
Now, I’ll explain how to write an expression!
Write Script for Expression
Lay out materials
First, place the material on the Composition panel. Try writing a script to change the position properties of this material using expression.
Show Position property
Select the layer and press P on the keyboard to display only the Position property. Then add an expression to this Position property.
From Animation tab in the menu bar, click Add Expression.
Then we can see the Expression is added to the Position property.
Alternatively, you can add an expression by clicking the stopwatch icon while holding the Alt key on the keyboard.
Expression was added under Position property like this.
Now we will write the script in the script text box to randomly change the value of the Position property.
If you type [time*400] in the text box, you will receive an error message like this.
The position property are two-dimensional and require X-axis and Y-axis values, so let’s correct the description.
If you click Play in the preview panel, you will see the animation like this.
Turn on/off Expression
We can click this icon in the Expression property to switch the expression on and off here.
To delete an Expression, select the Position property and then click Delete Expression from the Animation tab in the menu bar, or click the stopwatch button while holding down the Alt key on the keyboard.
Link Expression with other properties
Next, we’ll explain how to link an expression to other properties!
Place the materials on the timeline
Place the background and illustration materials on the timeline panel.
Apply [ Gaussian Blur ] to background layer
Select the background layer and then drag and drop Gaussian Blur from the Effects & Preset panel to the selected layer.
Add Expression to Blurriness property of the background layer
We will add an expression to Blurriness property of the background layer.
Add Expression to Opacity property of the illustration layer
Next, select the illustration layer and press T on the keyboard to display only the Opacity property.
Then add the expression to the Opacity property.
You can change the Opacity property value of the illustration layer at random by entering the script [random(70,100)] in the text box.
Link Effects property
To link the properties of the two effects, drag the Expression Pick Whip added to the Blurriness property of the background layer and drop it into the Opacity property of the illustration layer.
In this way, the Opacity of the background and the Opacity of the illustration change simultaneously.
This is the end of the lecture on how to use the Expression!
How is everyone doing?
Did you understand today’s lecture?
See you again for the next lecture!
See you soon! Bye bye!