From the course: After Effects Guru: Keyframe Assistants

Converting animation between expressions and keyframes

"

- One of the most powerful ways to create animation inside of After Effects is to combine the use of expressions and keyframes. But even more powerful than that, you can convert between expressions and keyframes. For example, I can create an expression, make my adjustments to the animation and then convert that to keyframes, and then use those keyframes to further refine that animation. Once you get comfortable using expressions, it's not that uncommon to want to actually convert the expression back to keyframes to give yourself a little bit more control. So that's what we're going to do here in this project. Let's start by selecting layer one in the timeline. And make sure you have your Position parameter open. I'm gonna hold down the opt key on the mac or alt on win and click on the stopwatch to add the expression. Let's go to the flyout menu, and go down to Property, and choose wiggle. So let's change the frequency to a setting of four, and the amplitude, let's set it up to around 85 pixels. And we don't need a lot of detail in the wiggle itself, so we'll leave the octaves set to one, and just click outside the expression to set it. Now I'm gonna load up a RAM Preview here, and after the first few seconds loads, I'll press the space bar so you can see. This looks pretty good. But in the real world, we all know that clients wanna change things. So let's play the client and say instead of having this sort of floating around the scene, I want it to pop from position to position. But I like the overall animation, so can you keep it kind of the same but make it pop? Well to do that, I'll just press the space bar to stop the animation, and a good workflow is to select the layer and press cmd + d to create a duplicate and just turn the original one off. This way I'm working on a copy. That way, if somebody actually changes their mind back, I don't have to start over again. So let's press the u key twice kind of rapidly, and that'll open up our Transform expression here. I wanna select the word Position and then go up under Animation and choose not Remove Expression but Keyframe Assistant, Convert Expression to Keyframes. That way I now have a bunch of keyframes. The problem with this initially, if I zoom in on the magnification of my timeline here, you can see I have a keyframe on every single frame. I don't necessarily want that. I just wanna see the maximum settings for when this bounces around the scene, not all the in-between frames. So what I need to do is actually smooth this out. So I'll click on the word Position again to make sure all of these are highlighted blue, letting me know they're selected. Then I'll go up under Window. There's actually a great tool you can use , Smoother. When you enable Smoother here, you can apply it to Spacial data like positions, or if you have Temporal data like rotation, you can apply it that way. But here, I'll go ahead and say Spatial Path, and we'll leave the Tolerance set to one and click Apply. Notice now, it's actually has many less keyframes. Let's just undo that last thing here and change the Tolerance up to five, and then click Apply. Notice the higher the number, the more Tolerance it is of variances before it actually deletes keyframes. So I like the tolerance of five, cause I still have plenty of keyframes here. But if I go ahead and right click on any one of these keyframes and choose Toggle Hold Keyframes, it's automatically going to mean this is going to pop around the scene. So let me deselect my text there and load up a RAM Preview. And as you can see, very quickly, I've not only got my animation popping around the scene, but I have many less keyframes to work with. So the Smoother is kind of a really important tool when you're converting expressions to keyframes. Once you have the basis of the animation out, then you can work with the individual keyframes, like toggling them to hold keyframes or just making adjustments to the keyframes to create more finite control of your overall animation.

Contents