Here's how to apply squash and stretch to your animations.
Squash and Stretch is one of the main principals of animation, yet a lot of animators leave it out of their work. I’m going to show you the basics of this technique, and then show you how to apply it in After Effects. It will give you another tool to polish and finesse your animations, giving things more weight and oomph.
Make sure you check out the very cool Auto-Squash-and-Stretch rig that comes with this lesson, as well as access to a video where Joey breaks down in excruciatingly dorky detail how he created the expressions that drive it.
Tutorial Full Transcript Below 👇:
Joey Korenman (00:11):
Hey there, Joey here for school of motion. And today we are going to talk about one of the principles of animation squash and stretch. If you're not sure what animation principles are, they're kind of the secret sauce that makes your work feel good. Squash and stretch is just one of the principles. And there's many more that we can't cover in this lesson. If you really want some in-depth animation training that will give you the foundation you need to create truly outstanding work. You're going to want to check out our animation bootcamp course. It's several weeks of intense animation training. You also get access to class only podcast PDs and actual critiques on your work from our experienced teaching assistants. Also, don't forget, you can sign up for a free student account so that you can grab the project files from this lesson, as well as assets from any other lesson on the site.
Joey Korenman (00:58):
So let's go into after effects and take a look. All right. So here is the animation we built in the previous tutorial. Um, and I'm going to kind of walk through, um, where this started from and how it developed now. Um, whenever, you know, I do an expression like this, or like, uh, this is actually multiple expressions. Whenever I build something like this and after effects, it's not a process that's linear and goes from a to B and I know every step along the way, um, I'm basically experimenting and tweaking and thinking up new things and then having to go back and revise. Um, so I want to try to give you guys a little bit of the sense of that, because if you ever decide to try something like this, um, it can be very frustrating, but I want you to know that it should be frustrating.
Joey Korenman (01:48):
That's just how this is. It's, it's, it's programming and it's animation and it's all wrapped into one and it's, and it can be very complicated when you get into stuff like this. But, um, if you just keep bashing your head against the keyboard, eventually you can get something really, really useful, hopefully that you can share with other people. Um, so let's make a new comp, all right. And, um, let's add a circle and by the way, just so you guys, if you didn't know this, if you want to add a new shape layer, um, you can select, you know, one of these options here, I pick the ellipse tool. If you double click it, it creates a shape that fills your comp. All right. So now if I hit you, you and you just double tap you, it brings up all of the, uh, options for a layer that are, that have been changed or are not the default settings. So it's bringing up the size of this layer. So now I can just set this to, let's say 50 by 50, get a nice little ball here. We're good to go. Okay. So first, why don't we just create a simple motion path just to try this out. All right. So we're going to start the ball here, position, and then we're going to go forward one second and move it up to the top right corner.
Joey Korenman (03:06):
We are going to easy, ease those quickly coming to the curve editor. Um, and of course I am going to need to, uh, actually I'm going to use the shortcut method here, which, uh, I normally don't do, but just to save time, I'm going to use the speed graph editor. And I'm just going to pull these handles out, which is basically the same as creating a really strong S curve in the value graph editor. So if I do a Ram preview, you'll see that I still get that slow acceleration, quick movement in the middle, slow deceleration at the end. Okay. So now if we wanted to be able to just simply with one control, figure out the squash and stretch of this, how would we do that? Okay. So here's the problem I was having. Um, and I'm just going to make a quick little example here.
Joey Korenman (03:54):
So here's another, uh, another circle for us. Now, if I set the anchor point of that right in the middle, and we just adjust the scale. All right. So if this circle was moving side to side like this, it would be easy to stretch it. Okay. You could stretch, stretch it on X squash on Y. Okay. Um, if it was moving up and down, same thing, you could stretch it on why squash it on X and get the shape you're looking for. Now, our circle is moving diagonally. It's moving, you know, like a 30 degree angle or something. So how do you stretch something at an angle and after effects? Well, um, as I showed you guys in the previous tutorial, you can go to a fact, grab a transform effect, set the anchor point and position to the center of your layer and then skew it.
Joey Korenman (04:50):
Okay. And you can adjust the skew axis. So that's one way to do it. Um, and then you could sort of come up with a way of skewing it and adjusting the skew axis. Now this is actually what I tried first, and the problem is skewing works great when something is at an angle, but let's say you just want the ball to move left to, right. Well, the skew axis, it's hard to tell what the circle, let me actually use a, um, let me use a rectangle here or a square. So you guys be able to see this better. All right. So if we do that same trick transform, put the anchor point right in the middle, put the position right in the middle and we skew it. You can see that it's actually not skewing it the right way when it's 90 degrees, you know, uh, it's sort of, it's bending it too.
Joey Korenman (05:47):
So what we, what we would end up having to do is, you know, right now it looks like it's bent sort of skewed at like a 45 degree angle. Well, what if I just wanted stretched horizontally? There's not a great way to do that using skew. So it would have to be some combination of SKU and then maybe rotation, but even that gets wonky. Um, so it, the SKU, wasn't the answer. And I knew that. So the way I ended up solving this was I realized that you can stack the transform effect. You can have multiple copies of it on a layer, um, and that was going to be the solution. And, and, and the, the way I came up with this was actually very interesting. I, I took a flame class at NAB several years ago and they showed this trick on a flame.
Joey Korenman (06:37):
And it, this is pretty typical in my experience. Anyway, with motion graphics is you learn something completely unrelated, eight, 10 years, you know, in the past. And then one day you're on a job or you try to figure something out and your brain solves it for you. And you realize this information that was useless 10 years ago has now saved my butt. So the way this works is, um, what we're going to do is we are going to rotate the layer, scale it, and then rotate it back. So we're actually gonna use three transform effects. Um, so let's do it on our circles so we can start building this ring. So the first thing we need to do is add a transform effect. And as I showed you guys the transform effect, uh, it, it, right now, if I scale this, for example, you can see that it's doing something weird, right?
Joey Korenman (07:24):
That's because it's scaling it from the anchor point of the transform effect, not from the anchor point of my layer. The anchor point of transform effect right now is in the middle of my comp, not where I want it. I want the anchor point and the position of this effect to always match where my layer is. So easy way to do that is hold option, click on anchor point, which adds an expression. When you option click one of these stopwatches and the values turn red, it gives you an expression box to enter and expression. Um, and actually all I need to do is type in position, and actually I need to type in this layer dot position. All right? So, um, this layer, this is all kind of a shortcut to just get to the position of this layer. Um, the long way of doing it would be, um, to pick whip this layer, and it would say this layer, and it would make a period.
Joey Korenman (08:18):
Um, and, and if this isn't ringing a bell, if this stuff isn't making a lot of sense to you, you should definitely go watch my intro to after effects, expressions tutorial, because it explains a lot of the basics of how expressions work and some of the syntax. Um, then I would come over here to this little, uh, language menu, and you would go to, uh, footage, sorry, layer properties, position. Semi-colon there you go. All right, now you can see when I did that on the anchor point, it actually moved my layer to the middle, which isn't what I want. Um, all you have to do is make sure your anchor point and your position are both set to the position. So I'm just going to copy this hold option and click on position paste that there we go. So now as my layer moves, you can see up here, if you watch these numbers up here, those numbers are now moving.
Joey Korenman (09:10):
Um, and they are matching now the position of this layer. So any transforms I do using this effect will actually work on the same anchor point as the layer itself. So these are now sort of just a separate set of position, scale rotation, uh, key frames I can add, which is great. Um, so, uh, right now, if we want to scale this, um, by default, it's set to uniform scale. So if we uncheck that we can, now, there we go, we can, uh, manipulate the height and the width separately. Okay. So you can see, we still have the same problem. The width only goes left to right. The height only goes up and down. How do we scale it at an angle? All right, well, what we need to do is figure out what angle this is moving at. All right now that was the trickiest part of this whole thing.
Joey Korenman (10:02):
So it turns out that there is actually a good way to figure out the angle. A layer is moving in after effects, and that is to measure two points along that layers path. And then you can measure the angle between those two points. Um, so I'm going to show you guys how to do that. Um, so what we are going to do is put an expression on the rotation parameter of this transform effect, option, click that. So, um, what we need to do is, um, we need to create two variables, 0.1 and 0.2, and get the position of this layer at two different points in time. So 0.1 is just P one equals, uh, and I'm going to do this layer dot position.
Joey Korenman (10:56):
Now I don't want this layer is positioned at its current time. Uh, what I want to do is measure its position a little bit before and a little bit after the current frame. So that way I'll know what direction it's moving. Um, if I know where it's been, and I know where it's going, I know what direction it's going. All right. So this layer position, and then another period, and there's a cool expression that I could do a whole tutorial on it's called value at time. So value at time. What value at time does, is it measures any property or almost any property, but at a different time than the current time. And so all you have to do is feed it what time you actually want to look at. Um, so the current time in, after effects is expressed by just typing in time.
Joey Korenman (11:48):
Okay. So if I ended the expression there, this would actually give me the current position. So value at time, time is redundant. It's just saying, what is the value right now? Okay, well, that's not what I want. What I actually want is what is the value one frame ago? All right. So the, the normal way would to, to say what w you know, the time one frame ago is time minus, and then I'm going to do another parentheses here, one over 24. Now why one over 24? Because after effects, expressions work in seconds, not in frames. So if I want one frame ago, I actually have to figure out how many seconds that was. And since I'm in, I'm working at 23, 9, 7, 6 are pretty much 24 frames. A second. I have to divide one frame by 24 frames per second. Now, what happens if you guys want to use this expression, and you're not working at 24, what if you're working at 25, you're working in pal or something?
Joey Korenman (12:50):
Um, so that occurred to me. So what I did was I created, um, a variable at the top here, FPS and FPS. I'm gonna set it to this comp frame duration. All right. And just to show you guys that I had to look that up. Um, if you go down to comp in a, in your expressions menu, um, you can actually see that you have frame duration right here. What frame duration tells you is not the frames per second. It's how long one frame lasts. Okay. So, um, frame duration in a 24 frames, a second comp is one divided by 24. So now I can just replace this with FPS. Okay. And the great thing about doing it this way is that if I change the frame rate of this comp to 30 or 25 or 60, or if I'm Peter Jackson 48, then, um, I don't have to update my expression.
Joey Korenman (13:55):
It will automatically do it. And when you're writing rigs that you're going to share, and that you want to be, you know, easily reusable, you want to try to think ahead to things like this. So let's move on to P two P two is going to be this layer position, the value at time. Now we're going to do time plus one frame. Okay. So now we have the position of this layer. All right. You can see here's the motion path. So I have the position one frame ago, which is right about here. And one frame from now, right about here. All right. So now using some geometry, which might be a terrifying concept for some of you guys, but you don't really have to know geometry because you have something even better. You have Google, and this is exactly how I found this expression. Um, I suspected I would need geometry for it, but I didn't want to have to open a math book. So, um, I Googled, um, you know, after effects, expressions, find angle of layer or something like that, I'll link to the actual page I found so I can give credit. Um, and I found an expression that does exactly this. You take two points and it gives you the angle between them. And it's perfect. Um, so what I'm going to do is just come over here and I'm going to copy that right out of this and paste it in there.
Joey Korenman (15:24):
All right. And there's some extra stuff on the, uh, on the end here I need to get rid of. All right. So let me walk you through the second part of this. So we have 0.1 0.2. What we need to find is the difference in X and Y between 0.1 and 0.2. All right. So what happens next is a variable called Delta is created. Delta is the, um, the result of subtracting 0.1 and 0.2 or subtracting point twos position from 0.1 position. Now, 0.1 0.2, both have an X and Y value. So you could separate the X and Y out and subtract each one separately. What this expression does sub is it just does that all in one, go for you. Sub can take variables that have more than one value, like an X and Y, and it can subtract the X's and the Y's all in one thing.
Joey Korenman (16:18):
Then once you have that you use, and, you know, if you're like me, you didn't even remember that this existed, but you have to use an arc tangent, um, which is a way of figuring out an angle based on the length of two sides of a triangle. You don't really need to know that all you need to know is that this expression works and you can copy and paste it in, and you're good to go. Um, so we have the difference between 0.1 0.2, we get the angle of, uh, between those two points using this math arc tangent expression. Then we have to convert the result of that from radians into degrees. Um, and if you're not familiar with radians, radians is another way of expressing an angle it's based on PI. Um, and, and when you're doing math, you know, geometry, a lot of times works in radians, not in angles.
Joey Korenman (17:10):
So, um, this converts it into degrees because this rotation property is expecting degrees. Um, and then, uh, I can erase this little plus zero thing here. Um, and then this, uh, and then it's taking the negative of that angle. And it's doing something with a percent sign in 360. I'm not exactly sure. I'd have to look that up. But the result of that is now that this, uh, this rotation property actually matches the angle that this layer is traveling at. And to prove it, if I scale the height, not the height, the width you can see, it's kind of, um, perpendicular to that, right. So it's not lining up exactly just yet. Um, but it's, you know, you can see that it does orient. And if I add a point here on this motion path, you'll see that this does rotate and it kind of sort of follows the motion path.
Joey Korenman (18:10):
All right. So when I had this, I knew I was con uh, close, but not really close, like I had figured out something, but I wasn't sure what, um, and so let's just get rid of this negative sign and see if that fixes it. And, oh my goodness. Look at that. It fixes it. All right. This, I'm walking you guys through my thought process and sort of the trials and errors that I went through when I, when I made this. Okay. So now we've got something kind of useful here. All right. It's actually orienting along the path all by itself. All right. So let's, uh, let's set this with back to 100 now I realized that, um, this ball doesn't have a lot of detail and it's going to make it kinda hard to tell if this expression is really working. Um, so before I went too far, I decided to add a Stripe to it.
Joey Korenman (18:59):
Um, and so, uh, you know, I could show you how to do that with shape layers, actually, I'm going to cause this is the bonus tutorial because you guys were nice enough to sign up for the email list. So I'm going to do that really quickly. So what's great about a shape layer and why don't I just rename this ball, make it kosher? Uh, what's great about shape layers is you can have multiple shapes within the layer. Um, so what I'm going to do is with this selected, I'm going to add a rectangular shape here. You can see I'm getting some crazy stuff here because this layer is rotated, which is fine with me. Um, so now I have a rectangle and an ellipse, and what I need to do is first make this rectangle a different color so I can, I can see it.
Joey Korenman (19:44):
So let's take this. Let's just make it white. Okay. Um, and then I need to crop it. So it only shows up within that circle. All right. So a shape layers work a lot like Adobe illustrator. You can actually merge paths the same way and get some cool compound shapes. So what I'm going to do is add an empty group. All right. And I'm going to call this group Stripe inside of that group. I need my rectangle path and I also need a copy of my ellipse path. So I'm gonna duplicate that ellipse path and bring it up here, put it inside of that Stripe group. And then what I'm going to do is inside of the Stripe group with it selected, I'm going to add a merge paths. All right. And when I do this, you can have different modes right now, it's set to add, I want intersect.
Joey Korenman (20:43):
So it's basically giving me a new shape where these two paths intercept, um, and then that merge pads comes with its own stroke and fill. I don't want the stroke. I do want the fill and I want that filter to be a different color. And look at that. Now we have a white Stripe on the ball. It's all in one layer. Um, and we're good to go. Okay. And what's great about this is that if I had this ball rotating, it will rotate as it goes along the path. But if it's being stretched by the expression, it will stretch sort of as it's being rotated. So you see, this is the power of using this transform effect. You can sort of combine and make these compound transforms. That would be really tricky to do any other way. Um, all right. So now we have our ball and our rotation expression appears to be working.
Joey Korenman (21:37):
All right. Now here's uh, here is what was throwing me. Okay. I don't actually want delayer to auto orient. Okay. Um, and now that the Stripe is on there, you can see the problem. Uh, if I let's say I have a ball and I want it to do just like a bouncing animation, right. Just like this, I don't actually want that ball to rotate along the path. Right. That's not what balls do I want to be able to control that myself, but I do want it to stretch along that. Okay. So that left me with a conundrum. All right. So what I realized needed to happen was I need to rotate the layer, then scale it so that it's scaled in the right direction, but then rotate the layer so that I can actually handle the rotation of the ball or whatever the layer is by myself and not have the expression do that for me.
Joey Korenman (22:38):
All right. Um, you know, I want this ball to basically stay oriented. However, I tell it until I change it. So that's when I came up with the idea of separating these transform effects into different parts, so I could control each part separately. So the first part is rotating the layer in one direction. Okay. Now let's duplicate this and we'll call this transform effect scale. All right. So what I'm going to do is hit you, so I can open up my expressions here and I'm going to delete this rotation expression. Okay. So what I want this second, uh, effect to do is to either scale or squash or stretch this, right. So it's, it's, it has been rotated. Right. Um, and I know this isn't going to make sense until the next step too. So let me, let me just go ahead and add my next rotation.
Joey Korenman (23:39):
So I have, oh one rotate. Oh, two scale. Oh three on rotate. All right. And so what's going to happen is the first step rotates it. The second step is going to stretch it and it's gonna stretch it in the wrong direction, but then it will rotate it. And now it will be stretched back in the right direction. Um, and this, this goes back to, you know, the flame class I took and I have to tell you professionally, I have never used a flame, but I learned something useful in that class. You never know what you're going to take away from learning stuff. Um, so on the [inaudible], this is going to be a really simple setup. Um, this rotation, uh, this whole rotation expression here, we can just get rid of all we need to do. All right. And what I'm going to do is I'm going to hit the Tilda symbol.
Joey Korenman (24:28):
So if you, if you guys don't know Tilda key, uh, wherever your mouse is over, when you hit it, it will make that temporarily take up the whole screen. It's a very useful shortcut. Um, so I basically want this on rotate to just negate whatever's going on with this rotate. So if I, um, hit option, click on rotation here, and I pick whip to this, but then I come to the beginning and just add a negative sign. There we go. I'm gonna hit the Tilda again. So now what's happening is the ball is not actually rotating along the path anymore. However, if I go to now, if I go to, oh, to scale and scale it, all right. And you can see now we're getting some interesting stuff. We're getting this perpendicular bend, which is not right. However, it is orienting to the path right now.
Joey Korenman (25:30):
Why is it rotating backwards? All right. So this was the problem I ran into. Uh, and I realized that what's probably happening is it's the order that I'm rotating things and I'm rotating it one way, then I'm rotating it back the other way. And whatever I'm doing is making it rotate backwards. Okay. And you can even see here, as it comes over this hump, it spins completely the opposite way you would expect it to. Um, so what I did was I came into oh one rotate. Um, and I just took a look at this rotation expression and was, and it just out of curiosity, I thought, what if I put a minus symbol in front of this and whoa, would you look at that? And now we're good to go. All right. And you can see that what's cool is it is orienting along that path.
Joey Korenman (26:19):
However, this Stripe in the middle of the ball is staying flat. It's not actually changing its angle at all. All right. Um, so if I, if I go into scale here, um, and I turn the width down, so it's not so extreme, right. You can see that that layer, it retains any transforms. I have it. And all it's doing is stretching along the path. All right. So what I've basically done is built my own skew here that can skew that layer at any angle, by rotating it, then scaling it, then unmotivating it, and it gets its rotation automatically by choosing a point directly before and directly after the current position of the layer. Um, and using little geometry. All right. So now we we've kind of gotten close. Um, and when I realized this was working was when I said, well, what if this, this ball is rotating?
Joey Korenman (27:15):
Right? Um, if I give it its own rotation along this motion path, and just have it rotate a little bit, um, at, you can see that it's rotating and as it's rotating, it's still stretching, which is just awesome. Okay. Um, so now we actually have the rig. This is the basis of this rig. Um, the rest of it was just creating some controls. Um, so what I, what I knew was I wanted to control for the squash and stretch amounts. Um, so I added expression control, slider control, right. And I just called this S S on Mount, move it up to the top and I set it to 100. And the way I rig this up was, um, I tied the width, the, the scale width to the slider. All right. So that's really easy. All you gotta do is option, click that, and then drag this up to slider.
Joey Korenman (28:15):
All right. And so now this slider controls the squash and stretch amount. Okay. So squat, so stretch squash. Okay. Um, now of course, as I showed you in the previous tutorial, when I stretch something out, I want it to squash by an equal amount, so that the total volume of that layer doesn't change. So I need to put an expression on height that looks at the width and adjust itself accordingly. All right. So what I did was I added an expression to height, and I said, w for width equals whatever this width is. All right. So now, um, let's make this, let's make this an easy example. All right. So if I'm scaling the width to one 50, what is the height need to be? Well, the height needs to be 50 because I've added 50 to the width. I need to subtract 50 from the height.
Joey Korenman (29:09):
So, um, I had to kind of figure out in my head, how do I, how do I figure that out? So what I basically want to do is take the difference between the normal width, which is 100% and the changed width. So whatever that difference is, I need to subtract that from 100. Okay. Um, so if the width is one 50, then what that means is I have added 50 to the width. I'm going to subtract 50 from the height. Okay. So the height starts at 100, the same as the width. All right. And from that, I'm going to subtract and now I need to find the difference. So the difference is going to be whatever the width is set to minus 100.
Joey Korenman (30:02):
Okay. So there we go. So now when I set the width to one 50, the height goes to 50. Okay. If I set the, if I, if I go even longer, um, than the width, uh, you know, if I set the width to one 90, the height becomes 10, um, and an easier way to have done this would just be subtract. Whatever the width is from 200, but, you know, I didn't think that one was coming up with this. I came up with this, this much sillier equation here. So, uh, and then the great thing is, if this is less than 100, it's 50, then it increases the height. Okay. So this is now going to totally create this squash and stretch effect for us. All right. So now we have a control. Um, and at that point I said, well, shoot, I'm ready to start animating.
Joey Korenman (30:55):
Um, and I think, you know, I think that's about it. That's great. Um, so as I started animating the ball bounce, I found, um, some issues. All right. So why don't we just do a quick little, maybe one bounce here. Okay. So the ball is going to start here. I'm going to separate the dimensions. All right. And I'm just going to do the wide position first. All right. We'll go forward 10 frames and it's going to fall, and then we're going to go forward. Let's say six frames and it's going to come up about halfway. Okay. Um, so let's just quickly do the curves for this and try and fly through this.
Joey Korenman (31:35):
All right. So it's gonna accelerate till it hits the ground. It's going to pop back up, ease into that position. All right. So just like that, um, now at the same time, I'm going to animate the X position so that we actually get a little bit of a bounce. All right, there you go. Perfect. Now, um, if we put squash and stretch on, it's going to orient itself along the drop. Now, now the problem is when it hits the ground, it's going to squash and you can see that because of the way it's measuring the angle, it's looking one frame backwards and one frame forwards. Um, it's not gonna get the exact angle, right. All the time. It's going to be really close. And for most cases it's fine, but for extreme cases like a ball hitting a floor or something changing direction drastically really quickly, um, it's not going to be the right angle.
Joey Korenman (32:34):
So I needed a way to adjust that. All right. So that's when I to add another expression slider. So what I did was I duplicated SSM Mount, um, and actually I'm going to do this a different way. Now I'm going to use a, um, I'm gonna use an angle control here. All right. So this angle control, we're going to call it S S angle offset. Okay. Now, what is this going to drive? It is going to drive the initial rotation. All right. So let's hit you on this ball, go into the rotation expression. Um, and basically all we need to do is leave this part the same, but then add whatever the value of this offset is. All right. So if the offset zero, it's not going to affect it at all. If it's not zero, it is going to affect it. And it'll be something we can control. So I'm gonna do is say, plus click and pick whip to this, add a semi-colon. And we're good. So now this angle offset is going to allow me to key frame and, and sort of, you know, create some nice flat shapes. All right. For the ball. All right. So it's going to be zero here.
Joey Korenman (33:51):
And let me just go ahead and start key framing. So at the beginning of this animation, the ball is not moving all right. As it approaches the fastest point of its animation, which is this frame, it's going to stretch out to its maximum stretch, whatever that's going to be one 30, let's say, all right, when it hits the ground, it will immediately compress. So it will now go less than 100. So let's say it goes to 80, or it could compress a lot, say 60. All right. So now the angle's wrong. So what I'm gonna do is go back one frame, put a key frame there, go forward one frame and adjust this until it's right. Okay. And then on the next frame, I'm going to reset this and then it's going to stretch out a little bit as it reaches the fastest point, it's going to stretch out the most.
Joey Korenman (34:44):
And then as it reaches the top, it's going to go back to 100. Okay. So if we ran preview this, there we go. You see, we've got our nice little squash and stretch, bounce, animation going. Okay. Um, now when I started actually animating this on my background, which had a floor, that's when I noticed that when you squash the ball, it's squatting is squashing from the center point of the ball. When in reality, the ball is going to squash from the bottom of the ball, wherever it makes contact with the floor, that's the anchor point of the squashing. So I needed to be able to adjust that as well. Um, so then I duplicated SSM amount and I called it S S Y offset. Let's turn off key frames, set this to all right. So now I need a way you can see the rabbit hole that you go down when you start building regs like this.
Joey Korenman (35:46):
Um, I needed a way to actually shift the position of this layer down by a little bit or up, depending on what it's doing. Um, so I decided the easiest way would just be, add another transform effect. So I just duplicated this one here and let's name this, oh, for Y offset. Um, I'm going to hit you on this. I'm gonna hit my tilty key. You can see we've got a lot of expressions going on now. So on the, on the Y offset transform effect, fact, I'm going to delete this rotation expression. We don't need that. Uh, what we're actually going to change is the position. Um, so what we're going to do is start with whatever the position is, and then add whatever the Y offset is to this Y value. All right. So the way to do that is, uh, we're going to adjust the position expression here.
Joey Korenman (36:48):
All right. And I'm going to create a variable. So I'm going to say original equals this layer position. Um, so now what we want to do is get this a Y offset. So then we'll say Y off, I'm just making these variable names up Y off is now whatever the slider set to. All right. So now the value of this position is going to be, we're going to open it with brackets because it's expecting an X into Y. And whenever a property expects two values, you have to bracket them. So we're going to open the brackets. And first it wants the X value. So the X value is going to be the original position, but the, the first value of the original position, which will be the X value in after facts, when you have two values, the first one is, um, is numbered zero.
Joey Korenman (37:44):
And the second one is numbered one. So it's kind of confusing, but you just need to know that when you counting and after effects, you start from zero. So that first value original bracket zero, that's actually saying the original layer position, X value, then comma original one. So now the Y value plus Y offset. So we're basically taking the original position, feeding it back, but adding a Y offset to the Y value. Okay. So now, if I adjust this, this layer, you know, it will still move if I, if I zoom out so you can see this whole thing, um, the layer still moves exactly as it did before. And it still stretches and scales and follows its motion path, but it is now offset on Y and this is key frameable. So normally it's going to be a zero. So one frame on this frame, the why I've said is zero, go forward one frame, and we're just going to tweak it. So now it's touching the ground, go forward one frame, and it's zero. So there you go. That's, that's how it works. All right. It's that simple.
Joey Korenman (38:57):
All right. And, uh, the last thing I added for this rig was the ability to have a global sort of multiplier so that if you wanted more or less squash and stretch, you could easily globally apply that. Um, so let's duplicate this call it S S multiplier, turn off key frames, and we'll set this to one. All right. So if you multiply something by one, it doesn't change. So that's where we're going to start it. So what is this going to affect? This is going to affect, uh, the scale transform. Okay. And really all we need to worry about is the width, because the height has an expression on it that reacts to the width. All right. So let's go down here. Let's find that expression. So here's scale and here's width. Okay. So here is my width expression, and this is when I wish I had a, uh, sorry, my height expression.
Joey Korenman (39:56):
This is what I wish I had a bigger monitor, or maybe, um, you know, maybe two monitors or something like that. Um, okay. So the width here, uh, the width is looking at the SSM out slider. Okay. So really all we need to do is multiply that by the multiplier. All right. So if the width is set to, um, you know, 100, uh, and you multiply it by one, nothing's going to change. If you multiply it by two, what's it going to be? It's going to be 200, as I'm saying this to you, I'm having the same revelation I had the other night when I made this expression, that, that actually isn't going to work either, because what I actually want is I want that multiplier to affect just the change in squash or stretch. So when that, when this SSM out is set to 100, this multiplier shouldn't have any effect on it because when there's no squash or stretch going on, um, it should be unaffected.
Joey Korenman (40:58):
But as soon as you get some squash or stretch, then it will start to be affected. So how are we going to do that? All right. So again, what we're, what we really need to affect is the difference between the default value of 100 and whatever the new value is. Okay. So what we're going to do is we need to measure what is the amount of squash and stretch. So let's make a variable amount equals this, uh, the value of the SSM out slider. Okay. So then what we can say is we need to measure the change, uh, in that, in the squash and stretch avert, you know, as opposed to no squash and stretch. So, because we're, we're starting at 100, if we're going to stretch, we're going to go up to say one 50, the change is 50. That's what we need to measure.
Joey Korenman (41:50):
Um, so what we need to do is say the change. So many use D for Delta. Um, so D equals the amount minus 100. All right. So if we have stretched to one 50, this will give us a D of 50. Now I'm going to multiply D times this multiplier. Okay. So now the multiplied amounts, I'm just gonna put malt malt equals the mult equals D times the multiplier. So what we've done is we figured out the change in squash and stretch. And now we've multiplied that by, by default, by one, doesn't change anything. But if I change that to two, now it's going to change twice as much. But if it's not changing at all, if it's still set to 100, nothing will happen. Okay. And then what we want to return here is 100 plus that result of malt. Okay. So now, when this is set to 100, nothing happens.
Joey Korenman (42:54):
Okay. And let's just play this bounce animation. So you can see what's going on. All right. Now in the middle of this balance animation, if I change this to two, it's going to stretch twice as much. But if we go back to the beginning, it's still completely untouched. Okay. That's cause this multiplier is now only affecting the change in squash and stretch. Okay. Um, so now you can see it's a lot more exaggerated and you can crank this up. All right. If I said to three, you're seeing, I'm getting a really thin kind of goofy. And then when it hits the ground, it really splats becomes like a pancake. So it's too much. And then this also works. If you go less than one, um, if you want to decrease the squash and stretch, all right. And I guess if you want it to, you could even key frame this.
Joey Korenman (43:39):
All right. So by default, that's at one, but that is kind of a global factor for your squash and stretch. All right. So I think this rig has done. I think that's really, that's. It seemed a lot simpler this time around, cause I knew how to do it. Um, so there you go. That is how I built this rig. And if I wanted to apply this to anything, all I have to do is copy all of these effects onto a different layer. All right. So let's just do a quick test just to make sure that this works the way I think it does. Um, so let's hide the ball and let's make something that's not as obvious. Let's make us star something like that. Okay. Um, and I'm going to move the anchor point of that star into the middle. Okay. Um, and I'm just going to do a quick, quick little animations here. So it's going to start here and I go forward, let's go 20 frames. It's going to come over here. You can see the anchor points all messed up. So why don't we fix that? There we go. All right. So position go forward 20 frames, move it and we'll go. Another 20 frames come back the other way.
Joey Korenman (45:11):
I'm having all kinds of trouble here. People, here we go. All right. And then we'll, uh, we'll just use the default easy, ease on those. Save ourselves some time. All right. So here's what our stars doing. Okay. And now I'm going to come here. I'm going to disable all of these stopwatches. So we're kind of at the default values here. I'm just going to select all of these and copy them onto the star. Okay. So we come here, put a key frame on squash and stretch amount as it gets to the middle, it's going to stretch out and you can see it is stretching out in the right direction. And then as it comes here, uh, I'm going to have it, uh, I'm actually going to have it squash a little bit, just a little cause it's kind of decelerating. And then it's going to come back, stretch out again. And as it gets to the end, it's going to squash just a little and then it's going to reset back to 100.
Joey Korenman (46:23):
All right. So just that quick, you've got this thing, squashing and stretching and, and reacting in the direction that's moving. Um, and especially with something, you know, with like a complex contour, like a star, this would be very hard to do without a rig like this. Um, you'd have to either animate masks or you'd have to try and get it to work with the SKU, but then let's say you had the star moves straight up and down or left and right. It wouldn't work. So with this rig, this makes it very, very simple. So there you go. Thank you guys so much. And I will talk to you soon. Thank you so much for watching. I hope this lesson gave you a good understanding of the animation principle of squash and stretch. If you want to know more about how to use the principles of animation to really take your work to the next level, make sure you check out our animation bootcamp course for an in-depth learning experience, focused on teaching you the craft of animation. If you have any questions or thoughts about this lesson, let us know. And we'd love to hear from you if you use this technique on a project. So give us a shout on Twitter at school emotion and us your work. Thanks again. And I'll see you next time.