Bounce is very similar to amplitude, frequency, and decay. However, a bounce needs to keep positive numbers throughout, so we have to use different language to accomplish that. How do you use bounce when animating with an expression? Author Luisa Winters walks you through how to use the bounce expression parameter in Adobe After Effects.
- Bounce is very similar to amplitude, frequency, and decay. However, a bounce needs to keep positive numbers throughout. So, we have to use different language to accomplish that. Let's try it. Let's go ahead and open Composition "5.4 Bounce." In here, you're gonna see a green ball. Let's go ahead and keyframe the positions so that it goes from the bottom left to the bottom right. Now, let's add the following expression to position: frequency = amplitude = And let me change this to a lowercase.
decay = And now, we're going to write the actual expression. Let's just make this a little bit taller so we can see it a little bit better. So let's give values to frequency. Right, so frequency = one, amplitude = 1000 and let's leave the decay at one. Now, write the following line: bounce = Math.abs The abs method is going to return the absolute value of a number.
So minus three, if I get a value of minus three in here, this is going to turn it into a three. So this is going to keep all of the numbers that I get in the positive realm. Now, inside of the parentheses we're gonna type the following: Math.cos, and that's for cosine So before we had a sine wave, now we're gonna have the cosine. So, the math cosine, or Math.cos method, is going to return a value between minus one and one which represents the cosine of the angle.
So, again, the opposite of the sine that we were getting before. Now, after Math.cos, open-and-close parentheses, and inside of that parentheses we're gonna type the following: frequency * time * 2 * Math.PI Now we're gonna write the actual expression for the position. So a = b = c = and of course we're gonna put a,b inside of those brackets and there you go.
Alright, so a is going to look at itself. So a is just gonna be transform.position(0) which is already keyframed. And inside of b we're gonna have the following: amplitude * bounce which is obviously a variable. Divide that by Math.exp and in parentheses, we're gonna type decay * time Now, let's see how this works.
Well, it is bouncing. It is just the opposite of what we wanted. So let's go ahead and fix that. We're gonna leave frequency at 1, amplitude at 1000, decay at 1. We're gonna leave the bounce as it was. But, we are going to delete a, b, and c, and we're gonna type the following: b = amplitude * bounce / Math.exp open-and-close parentheses, semicolon, and inside here: decay * time Now, we still need to define this a little bit better or we're going to get an error.
So it's gonna just be position and in here it's gonna be a minus, open-and-close brackets. Inside of the brackets is going to be 0, as in position 0, comma b. And now, the bounce happens correctly.
- Adding expressions
- Editing expressions manually
- Changing expression dimensions: rate, value, music amplitude, etc.
- Working with expression variables
- Using the Expression Language menu
- Using random values