Welcome to this new section of the After effects course in this lesson we're going to understand expressions and how you apply expressions to your layers in after effects basically what an expression does is it's a mathematical way to adjust layer properties. Anything that is key frame a ble basically. And you can add expressions to those key frames. So with this sort of wiggling ball right here, I added an expression that tells it to do this wiggling. It's sort of a random amount of wiggling and I'm not using any key frames whatsoever. Another example that you can do with the wiggle effect is this flickering light bulb and that's what we're going to be doing in the follow up lessons. We're going to be creating this flickering light as well as the camera and we're going to be adding lights, which is something we haven't touched upon in this class. So this is all done with the wiggle expression And expressions are a very advanced part of After effects and you can go and and look up lots...
of different types of expressions. My goal with this class is to help you understand how expressions work, how you apply them and then give you sort of an introduction to the ideas of what is possible with expressions. And then if there are things where you think, oh can I do this with expressions. There's lots of tutorials online. There's lots of expressions you can find online and there's actually lots of references within after effects that you can use. So first let's explain by actually doing so first let's explain by doing so, let's create a new composition, add a white background. So command wide at a white solid, I'm gonna lock that in place and then just create a little ball. So I'm creating a perfect leaf, spherical blue ball and I'm putting that in the middle of the layer using my aligned tool. If we wanted to get this sort of motion before what would we have done? We would have opened up the position properties, we would have set a key frame here, gone forward in time, moved it here, moved it here, go forward in time, move it etcetera etcetera, etcetera. And we would have got some sort of motion and you do have a lot of control over that motion. But what if we wanted to sort of wiggle randomly? Well, what we can do is instead of setting key frames, press the options button and then click the key frame, stopwatch. And that opens up this entire new system within after effects. So when your option, click any stopwatch, what you'll get is this text box where you can type in an expression and think of it as an expression as sort of a mathematical formula. So going back to our good old algebra days that that might help, there are also a few different buttons down here and this last one right here, The expression language menu is a cool one to dive into because you can see all of the different expressions that after effects has to use right here. And if you have one that you specifically think you want to use, you can find it within here. So for example, you might have an expression that you want that deals with the height of a layer or or here you have interpolation. So the easy easing of a layer. Now I know this is really advanced. Um so we're not going to dive into all of these. But here we have one that's called Wiggle. So you can choose one from that menu or there's also a reference up here. Help in the help menu. So if you click on expression reference that will take you to an adobe reference with a lot of help for expressions. But I'm just going to create one from scratch because it's called Wiggle. So I'm not actually creating this from scratch. It's within the program itself. You can't just type in a random word and hope that it works. But if you type in wiggle then left parentheses. Then in the number, let's just put two comma another number, let's put 50. Then end your parentheses. This is the wiggle expression. Now I want you to get used to pressing the semi colon after any expression because as you start to add multiple expressions to the same layer or the same property. You'll need to separate them with semicolons. And then when you're done, just click off. Okay. And that implements this Wiggle expression to this layer, which is the position. And you could do it to the position or the opacity and we can see what that looks like too. But now if I play this, our ball starts to move. So this expression is saying and you can just click into it to get back to it that twice per second. We want this ball to move the position by 50 pixels. If we wanted to go faster, we could put in 10, so 10 times a second. We wanted to move 50 pixels. If we wanted to move it more, we can increase the pixel amount. So let's put in 500. So it's moving 500 pixels on this composition. Now let's make this a little bit more organic. So I like that too. And then let's just do 100. So this is going to move it around so it looks like it's kind of floating in space. Let's copy this. And let's paste it to another property of this shape layer. So what if we wanted to also change in scale? So let's option click scale and pace this. So right now it's changing the scale both properties At a rate of two times every second. Okay, so that's pretty interesting. And that's also going to depend on where the anchor point is. What about opacity? So let's option click opacity paste. So right now it's changing the opacity twice a second Somewhere around up to 100 points for opacity. So if we do this at say 20 It's only gonna go up to 20% or down to 20% opacity and this is all random and you can see the numbers changing. So this goes down, sometimes it goes down to 80, sometimes 83. If we put it at And you would see that sometimes it goes all the way down. You know, it's going down to And it goes back up to 100 and it's all random. So this is how you can create sort of some organic motion or organic movement with an expression. And that's the wiggle expression. There's other ones that do all kinds of other things. So hopefully you understand the basics of using an expression because in the next lesson we're going to build out this composition, which is this flickering light. Using the wiggle expression, you can do some cool stuff like this without any key frames