Join Angie Taylor for an in-depth discussion in this video Easing ranges and values, part of Learning After Effects Expressions.
You can use expressions to do some really clever things, including lip syncing. And I'm going to show you a technique here where you can animate the time re-map value of a piece of video footage, to make it look as if the object in the animation is talking. In this case I have a dog, and if I just scrub you'll see I've created these random mouth movements. Between Say maybe zero and two seconds, I've got these random head and mouth movements.
This is just a test piece that I made in Poser. I've also got an audio file in here of a woman speaking in French, so I'm just going to play that for you. >> So what I want to do, is I want to get the dog speaking those phrases, and to do that, what I'm going to do is use expressions on the time remap value. Now you'll notice if I move the time marker back and forwards.
I can make the dog's mouth open and close. And it kind of starts to look as if the dog's talking if I time that with some audio. So that's my idea. I get the dog talking by moving this backward and forwards to open and close its mouth. Okay, And that's what we're going to do here. So I've added an expression to the time remap value. Okay. What I'm going to do is select that and activate it. Let's just switch that on.
And basically, it's looking at this audio amplitude layer that I created. As we saw earlier, I can create an audio amplitude layer from the audio in my comp. Now if I preview it with that applied, you'll see that it is taking the result of the audio. But we're not quite getting the result we want. Let me just show you. >> Okay and if we have a look, basically our values, they're a little high. Remember, we want to take our values from between zero and two seconds.
And we're getting values outside that range, so And is closed at that point. So we're not getting enough opening and closing of the mouth. In order to understand why, we need to go to our audio amplitude layer. Select that. Hit u on the keyboard to open up our key frames. Now I'm going to close left and right channel because we're taking the values from the both channels. I'm going to select those key frames and click on the graph editor. And that shows me a graph of my key frames. Now, notice it's showing me up here in the info palette the duration of the in and out point.
If I click on the word slider, it selects those values and gives me a minimum and maximum value. So now I can see I'm working between zero and 64 as my minimum and maximum value. Okay. We don't really want to work between those values. We don't really want a high of 64. We want a high of maybe one. So what we're going to do is go to our timely map expression. Take the graph itemizer button off so we're back in our regular view.Let's make that expression a little bit bigger so we can see what we're doing.
And what I'm going to do is create a variable. So I'll say A. Equals this expression. We put a semicolon at the end and hit return to create a new line. I'm going to use a new expression called ease. We used linear before. We're now using ease. And just like with key frames, you can have an eased expression or a linear expression. And, in this case, ease will give us a slightly smoother result. I'm then going to open up parenthesis and type in the letter a.
So, the first thing you need to do is tell it which value you're point to if you like. So, we're point to This comp layer, audio amplitude, affect both channels slider, which is represented by a. Then I put a comma and I say, right, what's the current range? And I think we said it was between one and 64, roughly. And then what do we want that range to be? Well, we want it to be a range between zero And 1. So we're saying, take values between 1 and 64, and remap them, if you like, to values between 0 and 1.
And if I click away from the expression and just preview that, we should now have the mouth opening and closing a little bit more successfully. >> So that's the ease expression that can be used to convert one range of values to another and to ease the result to give you a nice smooth animation of the dog talking.
- What are expressions?
- Creating and applying expressions
- Linking expressions to layers with the pick whip
- Simplifying expressions with variables
- Creating looping animations
- Randomizing values
- Converting expressions to keyframes
- Creating keyframes from audio with expressions
- Controlling 2D effects in 3D space
- Converting color from RGB to HLS
- Formatting strings and text