Download Project File

How To Create a Bouncy Ball in After Effects – Part 3

Part 3 Light and Shadow Setup Cover

Alright, so now we get to do the fun part. We’re going to do some basic rigging. We’re going to rig the light and the shadow so it works well together. We’re going to do that using some basic expressions and some basic math. Notice I’m saying basic, so don’t freak out. It’s going to be very basic. I promise!

First, we’re going to create a Global Light Direction. For that, we’re going to select the Controls layer. Then we’re going to go to Effect Controls Panel at the top and we’re going to lock this in so we can see it the whole time.

Select layer and lock in After Effects

We’re also going to add an Angle Control. To do that, just right-click on the Effects Controls Panel, go to Expression Controls and click on Angle Control.

Angle Control After Effects

Let’s rename the Angle Control to Light Direction like so.

Light Direction After Effects

Okay, so this is going to be our Global Light direction right now. It doesn’t really do anything because, by itself, it’s just a menu item. It doesn’t really do anything unless you attach something to it. So that’s exactly what we’re going to do next.

We’re going to select the Ball layer. We’re going to collapse it down to see the Master Properties. If you saw the first video, you probably saw me setting up these Master Properties.

Master Properties After Effects

We can control where the light is hitting the ball by adjusting the Light Direction in our Master Properties. So we can tell this Light Direction in our Master Properties to be linked to the Light Direction in the Ball Animation in the Effects Control Panel by just pick whipping like so.

Pick Whipping in After Effects

That’s all you have to do. Now we can control the light direction from the Controls Panel. It is now a Global Light direction. Now let’s do the same thing for the shadows.

We’re going to go and select this Ball Shadow press E to reveal drop shadow.

Ball Shadow After Effects

Next, we’re going to work with the direction property inside of our Ball Shadow.

Direction Property Ball Shadow After Effects

Now naturally, you probably thinking, hey, just parent it to Light Direction. Unfortunately, it won’t work properly that way.

We need to do some minor adjustments for our shadow first. To do that, we need to go in the direction property and we’re going to do some basic expressions.

Right now it’s pointing to the angle control. After Effects is kind of guessing and saying, Oh, you want the value. But we want to be more specific, I don’t want it to guess. I’m going to say we want the value by typing .value at the very end of our expressions.

Value Expression After Effects

So we were pointing to the angle control. The angle control has different properties that have a name property, but we want a value property. So that’s what we want. Now when I click away, nothing happens. It’s just we’re more specific. Now we are referencing this value right here. So what we want to do, we want to take this value right now it’s in positive 45 degrees, we want it to go into negative so we want it to be negative 45 which will flip it to the other side. So to do that, you can either just put like a negative value

Or like negative sign right in front of it. Or you can say something like times negative one. And when you do that, when you click away, it says the current value 45 times negative one is negative 45. And notice the shadow one on this side. So now when I adjust the Global Light direction, you can see we’re hitting it from this side, and the shadow goes on the opposite side. So it’s working fine. So we have done that, that’s good. I’m gonna set it to zero. So it’s hitting from the top, the shadow is in the center. So it’s working well. Now, next, what we’re going to do, when I select this ball, when I move it side to side, I want for this shadow to move with the ball on the X on the width left and right. So how do we make that happen? Very simple. So we’re going to select the ball and also the ball shadows like both of them. And then we’re going to press P to reveal the position property. So right now, position property of ball and ball shadow. Both of them have X and Y. Both of those properties married together in one property. Now I want to split them I can do it.

Now I can split them using expressions. But we can easily do that. Doing this, select the position property of the ball and control, select the other position property. So we have two of them selected, and then just right click on it and click on separate dimensions. So when you do that, now we put x and y on separate properties, which is very handy. So now we can link this exposition of our shadow to the exposition of our ball, we can just do this done. So now when I move the ball, you can see the shadow moves with it. Now, the cool thing is when it moves up and down, the y position doesn’t move because it’s not linked. It’s set to zero. So that’s perfect. All right. Now let me zero everything out. Make sure it goes back to the center. So now here’s what I want to do when I move this bolt up and down. I want for the scale of this shadow to increase as well. How do we make that happen? Well, pretty simple, kind of. Let’s select this bowl shadow and press S to reveal the scale property.

And we’re going to click on the stopwatch to create an expression. So in here, we’re going to do what we did here, we split the x and the y visually, but we need to do that in the code, we want to split the x and the y so that we can tackle each separately. And to do that, we’re going to do some basic expressions. So I’m going to over explain, because I want you to get this. So we’re going to create a basic variable, just a made up English, just x, it can be anything, I’m just going to say x, or here, just type x. And I’ll tell it to be something I’m gonna say x, you’re going to be, and I’m going to say the first value, and I’m going to type value, which it refers when I say value means both first and second, but I want the first one. So to do that, we need to be more specific. So we’re going to go to the end of it here. And we’re going to enter a square brackets, and in square brackets, we would enter the index value of which value that we want. So if I went the first value, you would think it would be index one, but it’s actually zero because in After Effects, it starts at zero. So it’s 0123

And so on. So the first value is not one, it’s zero. So in here we’re going to enter zero.

Okay, so x actually equals this value, that’s all we did here. Okay, then we’re going to go to the next line, we’re going to say y, which is another made up variable. And the reason why I said y because x, y, we’re going to refer to that one. So to grab this value to point to it, I would just say value and then I would define which index I want. I want index one, remember 01. Okay, so we are pointing to this, so y means this. Alright, so now we have x&y defined, and the next thing we need to do, we need to marry both of them in the way to where it speaks the same language because this the final outcome is actually two values. But if I put one number, it wouldn’t match. So the outcome of this and the outcome of that they have to match you have to speak the same language. So we have to create square brackets again. We’re going to play x to the first

value and apply y to the second. And to do that, we’re just going to do it in here in square brackets, we’re going to say x comma y. That’s all that is. So x, which is the first value is going to be applied to the first value, and y is going to be applied to the second value. I hope you are able to see this. It’s very simple if you just think about the process, alright, so when I click away, nothing really happens. Because it’s doing the same thing. We’re just kind of we just took the same thing we had before we kind of broke it apart into two different lines, so that we can apply code separately. So in here, we’re going to create another variable right above here. And remember variable is just made up English. We’re going to say something like ball, y. position.

totally made up. So I want ball y position. So that’s why I wrote ball y position. It can be anything it can be surrogate. Don’t overthink this stuff. Yeah, it’s just made up. So we’re going to say bull white position. You’re going to be married to the

You’re going to be white position. So bull why you are from no one when I reference this, I really mean this value. In fact, we’re going to say, period value.

Okay? So so far, we’re good. So now I’m going to use this bull white position variable. And I’m going to do this, I’m going to go over here to two x scale. And when this ball goes up, I want to add basically, for the value to increase and natural, you would, you would say, plus Bo y position, right? You would just do this, and it works. But watch this. The reason why it doesn’t work is because of this. When I pull in it, you can see it actually scales down, and then it scales up it flips, so we need to go in the opposite direction because when you move up the ball up, notice the value here is actually a negative value. So because of that, when you say current value plus negative, it, it does the opposite. So we want to do instead of plus, we

To say subtract,

and now it works fine. So watch this. Let’s set it to zero. So when it moves on this, it’s working. Good. Now we want to do the same thing to the way we want to also grow this. So we’re going to say the same thing, minus this

obviously breaks, but here’s why. So the starting point actually works fine. But as soon as we start pulling on this hits, it’s not working. And the reason why because remember, this scale of the second value is this value divided by 10. And that’s how we get in. So that’s why it maintains that shape. It’s, you know, 60 and six, so we have to maintain the same aspect ratio, when we apply this to the second value. So we want to apply the same white boy position but we wanted to be divided by 10 to maintain the same position right. So when I click away, and when I move on this, you can see it does maintain the same position so it is working out

Hope you’re getting what I’m trying to say here. So that’s all that is, it’s just to maintain the same shape. That’s why we did this because this ratio needs to be the same when we apply everything else to it. Okay? So now obviously, if I pull in this, you can see, this bowl is like the shadow is way to pick, and I need to tone it down some. So how do I do that? Now you can do a number of different ways you can do it individually here, but we already have this bowl wide position, and we’re going to go to the end of it here. We’re just going to say, hey, let’s take your value, and let’s divide it by like to give me half of that. And you know, then it gives us something different. And you can kind of play with this to see which size you feel comfortable, like size will give you something like this. Now, if I take it down to 10, or up to 10, that’s where I’m gonna go with it actually gives me what I want. And it might be too small for you, but

you have to keep in mind we’re going to be feathering it as well. So it’s going to get bigger even more. So that to me

Natural feels good enough. So that’s all I’m going to do. So now if I grabbed the ball right here, if I move it, you can see it does increase, I can move it side to side. Now the last thing we need to do is adjust the feather. So we’re going to do this right here. So to do that, we’re going to select this ball shadow, press E to reveal drop shadow, we’re going to go to softness. So we’re going to select this hit s twice to solo it. And here’s what we’re going to do. We’re going to click on the stopwatch, remember, we’re going to create the same variable ball y position, we’re going to tell it to be this bowl y and we want it to be the value so we’re gonna say period value. And here’s what we need to do here. We’re just going to save the current value, whatever that was 150 right. But click away it just gives me 150. But we want to subtract bowl, y position, this one. So now when I move on it, you can see it blurs it big time, you can see the value changes. So that’s really it as far as rigging.

The lights and the shadow. So let’s zero everything out. And let’s test things out. If I go to controls and I’m moving the light, it does work. I can move it up and down. It’s it’s working as well. So that’s how easy it is to rig the light and the shadow and After Effects. Now in the next video, we’re going to talk about the stretchy property how to rig that up. So definitely check that out and I’ll see you there

Download Project File

About the author:

Sergei Prokhnevskiy

Sergei Prokhnevskiy is a Charlotte, NC based motion graphics designer, an online tutor, an entrepreneur, and Adobe MAX Master Speaker. Sergei is known for his quick and practical After Effects tips and tricks on YouTube, where he generated well over 6 million views on his tutorials. He has authored an online video course on After Effects Expressions and developed scripts for After Effects. He is also a former senior motion graphics designer at Fox Sports where he worked on graphics for NFL, Super Bowl, MLB, World Series, College Football, NASCAR, Women’s World Cup, and NASCAR Race Hub. He is very passionate about learning and teaching others.


Over 110,000 downloads & counting!

These 7 After Effects tools will seriously speed up your workflow and save you hours of wasted time. More than that, they could be the difference between being able to complete a project on time or not!