To wrap up the 100 series, we're gonna put everything together and work with a new expression.
To begin, I'm gonna find the property that I'm gonna work with, and add an expression.
So in this case, I'm gonna highlight the Planet layer and hit "S" on my keyboard to open up Scale
and I'm gonna add a new expression.
So, by default, an expression will already be highlighted here in the expression window
and it links to itself, so nothing will change.
Now, with this expression highlighted, I'm gonna use the Expression Language Menu
to build an expression.
So we can see what we're doing, I'm just gonna hit "~" (Tilde) on my keyboard to open it up fullscreen.
And I'm gonna go highlight the expression again, and I'm going to hit the arrow key
here on the Expression Language Menu.
This is gonna open up all the categories.
For this example, I'm gonna be looking in the Interpolation category, and, more specifically,
the linear method which has five arguments.
So, by clicking this, it's going to replace the default selected text here in my expression window.
And it's gonna give me five placeholder arguments that need to be edited.
So now I'm gonna click away and hit "~" (Tilde) again to collapse this.
And now, I'm gonna use the Pick Whip tool to replace the "t" argument with a property.
But in order to do that, the property has to be visible on the Timeline.
So, with the Planet layer selected, I'm gonna hold "Shift + T" to open up Opacity.
And I'm gonna go back in my expression, and I'm gonna highlight "t"
and I'm gonna grab the Pick Whip tool, and drag it down to Opacity, and release.
And this is gonna replace "t" with "transform.opacity"
Now that I've connected properties and values to the expression,
I can edit the inline code within the window to create more complex functionality.
So, the first thing that needs to happen is to make linear a variable.
And we'll go over variables later in the course.
So in this case, I'm gonna use "myFade = " and I'm gonna add a semi-colon to the end.
And this is gonna create a reference that we can reference later.
Next, I'm gonna select "tMin" which is the minimum input value,
and I'm gonna change that to 0, and I'm gonna select "tMax" and I'm gonna change it to 100.
And the reason for these two numbers is because Opacity ranges from 0 to 100 as our input,
and it's gonna remap them to "value1" and "value2" for our Scale value.
So, for "value1" I'm gonna change this to 80 Scale, and then "value2"
I'm just gonna leave this at 100 Scale for now.
So the next step, I'm going to come to the end of the semi-colon, and I'm gonna hit "Enter"
to create a new line, and on this next line, I'm going to create a three-dimensional array
using the "myFade" variable.
So I'm gonna type [myFade, myFade, myFade]
and this is gonna map the myFade linear function to all three Scale positions for our 3D layer.
So now, if I click off, it's gonna save our changes, and you'll notice that nothing's changed yet,
because our input is still at 100. But we're gonna change that next.
So now I'm gonna try adding another expression with a keyboard shortcut instead.
So if I come down and highlight Opacity in the timeline, and I'm gonna use
"Shift + Alt + Equal (=)" or "Shift + Option + Equal (=)" on a Mac.
This is the keyboard shortcut for adding an expression to a highlighted property.
So, for the Opacity property, I'm going to use the Expression Language Menu again.
I'm gonna come down to Interpolation, but this time, I'm going to use
an ease method with five arguments.
So, if I click that, it's gonna replace what we had originally.
And I'm gonna come in and manually add these parameters.
So I'm gonna change "t" to "time" as our input.
I'm gonna change "tMin" to something called "inPoint" which is gonna reference
the in point of our layer.
And then I'm gonna come over and change "tMax" to "inPoint" again, but this time,
I'm gonna " + 1" second to that value.
And then, finally, I'm gonna come to "value1" and I'm gonna make it 0,
and then "value2" is gonna become 100.
Essentially, what this ease method is saying is,
"map 0 to 100 Opacity value from the layer's in point to 1 second past the in point"
Now, let's see this in action.
I'm gonna hit "~" (Tilde) to collapse this back, and you'll notice the Planet has disappeared
because we're at the layer's in point.
But if I scrub in time from 0 to 1 second, you'll notice that not only does the Opacity
go from 0 to 100 across that time, but the Scale actually goes from 80 to 100
across that same time.
This is because the ease method is driving our initial animation from 0 to 1 second,
0 to 100 Opacity.
And then this is using that animation as a reference for its own.
So now that I have expressions applied to multiple layers, I can view how those values
are changing over time using the Post-Expression Graph.
So, first, I need to come into the graph editor by clicking this icon.
And I can then come down to each of my expressions and toggle the Post-Expression Graph.
So, here we see Opacity with this blue color, mapped from 0 to 100
and uses this nice ease animation curve.
You'll also notice that Scale X, Y, and Z are all mapped with these colors
and they're kinda stacked here on the same plane.
But, basically, they are following the same ease curve that the Opacity is,
because of their reference.
Alright, so now it's time for a quick bonus.
We're gonna add an Expression Controller.
So with the same Planet layer selected, I'm gonna add an Expression Control
from Effect > Expression Control > Slider Control and I'm gonna rename this "Planet Scale"
The next thing I'm gonna do is change this quickly to 50, so that we have an initial value that's not 0.
Now, once this is done, I'm gonna come down to the Planet layer, and select the Scale expression,
specifically the 80 value, which is the fourth argument in this linear method.
And, this is the initial Scale value which I am going to now pick whip
to the Planet Scale Slider.
So, as you can see, it's replaced 80 with
effect("Planet Scale")("Slider")
which references this property.
So, if I click off the expression window to save my changes,
you'll notice that nothing's happened, because we're at 1 second in time.
But, if I scrub this back in time, you'll notice the Planet now starts at 50, instead of 80.
And that's because the Planet Scale is the new reference here,
instead of the hard-coded 80 value we had before.
So, if I change this Planet Scale back to 0, and I RAM Preview, the Planet scales from 0
instead of 50.
We've arrived at the end of Lesson 106:
Adding A New Expression, Editing the Expression's Code,
Using the Expression Language Menu, & Viewing the Post-Expression Graph
If you enjoy this expressions course, consider purchasing the paid content.
It includes in-depth documentation, extra tutorial content, high definition videos,
and all the project files used in the training.
Your purchase will help to create more free courses like this in the future.