Squash and Stretch in After Effects

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.

If you have any questions, click over to the Q&A tab to post them. Other students can answer you, and we'll put our team on the case to try and get you a solution ASAP.


Check out this super helpful tutorial on easing your animations with animation curves:

Watch Intro to Animation Curves

    • بسیار عالی

00:00:00,035(synthetic electronic jingle)
00:00:11,172- Hey there, Joey here for School of Motion,
00:00:13,273and today we are going to talk about
00:00:15,102one of the principles of animation, squash and stretch.
00:00:18,762If you're not sure what animation principles are,
00:00:21,212they're kind of the secret sauce
00:00:23,029that makes your work feel good.
00:00:25,121Squash and stretch is just one of the principles,
00:00:27,382and there's many more that we can't cover in this lesson.
00:00:29,901If you really want some in-depth animation training
00:00:32,412that will give you the foundation you need
00:00:34,507to create truly outstanding work,
00:00:36,962you're gonna wanna check out our animation boot camp course.
00:00:39,560It's several weeks of intense animation training.
00:00:42,651You also get access to class-only podcasts,
00:00:45,440PDFs, and actual critiques on your work
00:00:48,100from our experienced teaching assistance.
00:00:50,592Also, don't forget, you can sign up
00:00:52,160for a free student account so that you can grab
00:00:54,072the project files from this lesson,
00:00:56,000as well as assets from any other lesson on the site.
00:00:58,812So, let's go into After Effects and take a look.
00:01:02,210Alright, so here is the animation we built
00:01:04,603in the previous tutorial,
00:01:08,498and I'm going to kinda walk through
00:01:11,956where this started from, and how it developed,
00:01:14,645now whenever, you know, I do an expression like this,
00:01:18,885or like a, this is actually multiple expressions,
00:01:21,605whenever I build something like this in After Effects,
00:01:24,136it's not a process that's linear,
00:01:27,126and goes from A to B, and I know every step along the way.
00:01:31,341I'm basically experimenting and tweaking
00:01:33,416and thinking up new things,
00:01:34,725and then having to go back and revise.
00:01:37,113So I wanna try to give you guys
00:01:38,965a little bit of the sense of that,
00:01:40,933because if you ever decide to try something like this,
00:01:44,715it can be very frustrating, but I want you know,
00:01:47,284it should be frustrating, that's just how this is, it's
00:01:50,114it's, it's programming, and it's animation
00:01:52,683and it's all wrapped into one,
00:01:54,114and it's, and it can be very complicated
00:01:55,874when you get into stuff like this, but,
00:01:58,112if you just keep bashing your head against the keyboard,
00:02:00,534eventually you can get something really really useful.
00:02:03,513Hopefully that you can share with other people.
00:02:06,295So, let's make a new comp, alright, and,
00:02:09,984let's add a circle,
00:02:13,262and by the way, just so you guys, if you didn't know this,
00:02:15,900if you wanna add a new shape layer,
00:02:18,730you can select, you know, one of these options here,
00:02:21,081I picked the ellipse tool, if you double click it,
00:02:23,826it creates a shape that fills your comp, alright,
00:02:27,228so now if I hit UU, and you just double-tap U,
00:02:31,768it brings up all of the options for a layer that are,
00:02:36,426that have been changed, or are not the default settings,
00:02:39,877so it's bringing up the size of this layer,
00:02:42,257so now I can just set this to, let's say,
00:02:44,54650 by 50, get a nice little ball here,
00:02:48,886we're good to go.
00:02:50,579Okay, so first, why don't we just create
00:02:52,996a simple motion path, just to try this out.
00:02:56,038Alright, so we're gonna start the ball here,
00:02:58,523position, and then we're gonna go forward one second,
00:03:02,377and move it up to the top right corner,
00:03:06,957we are going to Easy Ease those,
00:03:10,188quickly come to the curve editor,
00:03:13,285and, of course, I am going to need to,
00:03:15,926actually, I'm gonna use the shortcut method here, which,
00:03:19,412I normally don't do, but just to save time,
00:03:21,493I'm gonna use the speed graph editor,
00:03:24,261and I'm just gonna pull these handles out,
00:03:26,412which is basically the same as creating
00:03:28,379a really strong S curve in the value graph editor.
00:03:31,733So, if I do a RAM Preview, you'll see that
00:03:33,809I still get that slow acceleration,
00:03:36,011quick movement in the middle,
00:03:37,381slow deceleration at the end, okay?
00:03:39,459So now if we wanted to be able to just simply,
00:03:42,501with one control, figure out the squash and stretch of this,
00:03:45,850how would we do that, okay?
00:03:48,140So, here's the problem I was having.
00:03:51,670And I'm just gonna make a quick little example here.
00:03:54,419So here's another, another circle for us, now,
00:03:57,687if I set the anchor point of that right in the middle,
00:04:01,019and we just adjust the scale, alright,
00:04:03,518so if this circle is moving side to side like this,
00:04:07,677it would be easy to stretch it, okay,
00:04:09,959you could stretch, stretch it on X, squash it on Y, okay?
00:04:14,866If it was moving up and down, same thing,
00:04:16,528you could stretch it on Y, squash it on X,
00:04:19,566and get the shape you're looking for.
00:04:21,825Now, our circle is moving diagonally,
00:04:25,315it's moving, you know, like a 30 degree angle or something,
00:04:28,198so how do you stretch something
00:04:31,338at an angle in After Effects?
00:04:33,337Well, as I showed you guys in the previous tutorial,
00:04:36,136you can go to effects,
00:04:39,709grab a transform effect,
00:04:42,580set the anchor point and position
00:04:45,430to the center of your layer,
00:04:48,141and then skew it, okay, and you can adjust the skew axis.
00:04:53,350So that's one way to do it,
00:04:55,368and then you could sort of come up with a way of
00:04:59,357skewing it and adjusting the skew axis,
00:05:02,000now, this is actually what I tried first,
00:05:05,323and the problem is, skewing works great when something
00:05:08,930is at an angle, but let's say,
00:05:11,488you just want the ball to move left to right,
00:05:14,039well, the skew axis, it's hard to tell with a circle,
00:05:18,019let me actually use a,
00:05:20,589let me use a rectangle here, or a square,
00:05:24,010so you guys'll be able to see this better.
00:05:26,380Alright, so if we do that same trick, transform,
00:05:29,610put the anchor point right in the middle,
00:05:32,881put the position right in the middle, and we skew it,
00:05:37,738you can see that it's actually not skewing it
00:05:40,700the right way,
00:05:42,909when it's 90 degrees, you know?
00:05:45,778It's sort of, it's bending it too, so what we,
00:05:48,630what we would end up having to do is, you know,
00:05:51,220right now it looks like it's bent sort of,
00:05:53,720skewed at like a 45 degree angle.
00:05:56,133Well what if I just wanted it stretched horizontally,
00:05:59,433there's not a great way to do that using skew,
00:06:02,506so it would have to be some combination of skew,
00:06:05,405and then maybe rotation, but even that gets wonky,
00:06:08,906so it, the skew wasn't the answer, and I knew that.
00:06:13,376So, the way I ended up solving this, was
00:06:16,435I realized that you can stack the transform effect,
00:06:20,655you can have multiple copies of it on a layer.
00:06:24,094And that was gonna be the solution, and,
00:06:26,495and the way I came up with this
00:06:28,974is actually very interesting, I took a Flame class at NAB
00:06:33,533several years ago, and they showed this trick on a Flame,
00:06:37,025and it, this is pretty typical, in my experience anyway,
00:06:41,016with motion graphics is,
00:06:42,366you learn something completely unrelated
00:06:44,804eight, ten years, you know, in the past,
00:06:47,474and then one day, you're on a job,
00:06:49,274or you're trying to figure something out,
00:06:50,455and your brain solves it for you,
00:06:52,185and you realize, this information
00:06:54,205that was useless 10 years ago has now saved my butt,
00:06:56,564so the way this works is,
00:06:59,670what we're gonna do, is we are going to rotate the layer,
00:07:02,814scale it, and then rotate it back,
00:07:04,674so we're actually gonna use three transform effects.
00:07:07,754So let's do it on our circle,
00:07:09,876so we can start building this rig.
00:07:11,634So, the first thing we need to do is add a transform effect,
00:07:15,303and as I showed you guys, the transform effect
00:07:19,552it, right now, if I scale this for example,
00:07:22,034you can see that it's doing something weird, right?
00:07:24,695That's because it's scaling it from the anchor point
00:07:27,003of the transform effect,
00:07:28,634not from the anchor point of my layer.
00:07:31,145The anchor point of transform effect right now
00:07:33,626is in the middle of my comp, not where I want it.
00:07:35,905I want the anchor point in the position of this effect
00:07:38,575to always match where my layer is.
00:07:41,454So, the easy way to do that, is hold option,
00:07:44,856click on anchor point, which adds an expression,
00:07:47,235when you option click, one of these stopwatches
00:07:50,194and the values turn red, it gives you an expression box
00:07:52,754to enter an expression.
00:07:54,646And actually, all I need to do is type in
00:07:57,526position, and actually I need to type in
00:07:59,694this layer dot position, alright?
00:08:02,674So, this layer, this is all kind of a shortcut
00:08:06,085to just get to the position of this layer.
00:08:08,734The long way of doing it, would be to pick whip this layer,
00:08:14,444and it would say this layer, and I would make a period,
00:08:18,194and, and if this isn't ringing a bell,
00:08:20,263if this stuff isn't making a lot of sense to you,
00:08:22,356you should definitely go watch my
00:08:23,583Intro to After Effects Expressions tutorial because
00:08:26,355it explains a lot of the basics of how expressions work,
00:08:29,334and some of the syntax.
00:08:30,986Then I would come over here to this little
00:08:33,262language menu, and you would go to
00:08:36,754footage, sorry layer,
00:08:39,745properties, position, semicolon,
00:08:44,424there you go, alright?
00:08:45,645Now you can see when I did that on the anchor point,
00:08:47,466it actually moved my layer to the middle,
00:08:49,454which isn't what I want.
00:08:50,902All you have to do is make sure your anchor point
00:08:52,642and your position are both set to the layer position.
00:08:56,342So I'm just gonna copy this,
00:08:58,304hold option and click on position,
00:09:00,626paste that, there we go.
00:09:03,165So now as my layer moves, you can see up here,
00:09:06,375if you watch these numbers up here,
00:09:08,285those numbers are now moving,
00:09:10,395and they are matching now, the position of this layer,
00:09:13,214so any transforms I do using this effect,
00:09:16,386will actually work on the same anchor point
00:09:19,376as the layer itself, so these are now
00:09:22,444sort of just a separate set of position scale rotation
00:09:26,475keyframes I can add, which is great.
00:09:29,186So, right now, if we wanna scale this,
00:09:33,145by default it's set to uniform scale,
00:09:35,345so if we uncheck that, we can now
00:09:39,743there we go, we can manipulate
00:09:41,394the height and the width separately, okay?
00:09:43,754So you can see, we still have the same problem,
00:09:46,224the width only goes left to right,
00:09:48,624the height only goes up and down.
00:09:50,584How do we scale it at an angle?
00:09:53,114Alright, well what we need to do is figure out
00:09:57,425what angle this is moving at, alright?
00:09:59,956Now that was the trickiest part of this whole thing.
00:10:02,684So it turns out that there is actually a good way
00:10:05,663to figure out the angle a layer is moving in After Effects.
00:10:10,142And that is to measure two points
00:10:13,423along that layer's path,
00:10:16,506and then you can measure the angle between those two points.
00:10:20,325So, I'm gonna show you guys how to do that.
00:10:22,983So, what we are going to do is
00:10:25,904put an expression on the rotation parameter
00:10:28,805of this transform effect.
00:10:31,265So I'm gonna option click that, so,
00:10:34,185what we need to do is
00:10:38,045we need to create two variables,
00:10:39,546point one and point two, and get the position
00:10:42,855of this layer at two different points in time.
00:10:45,684So, point one, is just P1 equals,
00:10:49,406and I'm going to do this layer, dot position.
00:10:56,566Now, I don't want this layer's position
00:10:59,705at it's current time, what I wanna do
00:11:03,305is measure its position a little bit before
00:11:06,585and a little bit after the current frame,
00:11:09,235so that way I'll know what direction it's moving.
00:11:12,405If I know where it's been and I know where it's going,
00:11:14,294I know what direction it's going, alright?
00:11:16,384So, this layer position and then
00:11:18,945another period, and there's a cool expression that
00:11:22,954I could do a whole tutorial on,
00:11:24,113it's called value at time.
00:11:25,996So, value at time.
00:11:30,529What value at time does, is it measures any property,
00:11:34,170or almost any property,
00:11:35,891but at a different time than the current time.
00:11:38,460And so all you have to do is feed it what time
00:11:41,151you actually want to look at,
00:11:43,421so the current time in After Effects
00:11:45,599is expressed by just typing in time, okay?
00:11:49,080So if I ended the expression there,
00:11:51,501this would actually give me the current position,
00:11:54,339so value at time, time is redundant,
00:11:58,052it's just saying what is the value right now, okay?
00:12:01,346Well that's not what I want, what I actually want is
00:12:03,056what is the value one frame ago, alright?
00:12:06,695So the normal way would, to say, what, you know,
00:12:11,186the time one frame ago is time minus,
00:12:14,839and then I'm gonna do another parenthesis here,
00:12:16,921one over 24.
00:12:19,463Now why one over 24?
00:12:20,983Because After Effects expressions work in seconds,
00:12:24,681not in frames, so if I want one frame ago,
00:12:27,892I actually have to figure out how many seconds that was,
00:12:31,290and since I'm in, I'm working at 23-976,
00:12:34,872or pretty much 24 frames a second,
00:12:36,962I have to divide one frame by 24 frames per second.
00:12:41,734Now, what happens if you guys wanna use this expression,
00:12:45,161and you're not working at 24, what if you're working at 25,
00:12:48,493you're working in PAL or something, so,
00:12:52,432that occurred to me, so what I did, was I created
00:12:55,761a variable at the top here, FPS,
00:12:58,815and FPS, I'm gonna set it to, this comp,
00:13:04,004frame duration.
00:13:07,101Alright, and just to show you guys
00:13:08,732that I had to look that up, if you go down to comp
00:13:13,633in your expressions menu, you can actually see
00:13:17,711that you have frame duration right here.
00:13:19,560What frame duration tells you is not
00:13:21,650the frames per seconds, it's how long one frame lasts, okay?
00:13:26,238So, frame duration,
00:13:29,593in a 24 frames a second comp,
00:13:34,044is one divided by 24, so now I can just replace
00:13:38,914this, with FPS, okay?
00:13:42,676And the great thing about doing it this way
00:13:44,492is that if I change the frame rate of this comp
00:13:47,501to 30 or 25 or 60 or,
00:13:50,342if I'm Peter Jackson, 48, then,
00:13:53,791I don't have to update my expression,
00:13:55,401it will automatically do it, and when you're writing
00:13:57,788rigs that you're gonna share, and that you wanna be,
00:14:00,294you know, easily reusable,
00:14:01,949you wanna try to think ahead to things like this,
00:14:05,319so let's move on to P2.
00:14:06,750P2 is going to be this layer,
00:14:11,179position, value at time,
00:14:15,956now we're gonna do time plus one frame.
00:14:20,017Okay, so now we have the position of this layer,
00:14:24,816alright, you can see here's the motion path,
00:14:26,356so I have the position one frame ago,
00:14:28,597which is right about here, and one frame from now,
00:14:31,537right about here, alright?
00:14:33,086So now, using some geometry, which
00:14:38,076might be a terrifying concept for some of you guys,
00:14:40,555but you don't really have to know geometry
00:14:43,251because you have something even better, you
00:14:45,695have Google, and this is exactly
00:14:47,996how I found this expression,
00:14:50,766I suspected I would need geometry for it
00:14:53,172but I didn't wanna have to open a math book, so,
00:14:56,074I Googled, you know After Effects expressions find
00:15:00,826angle of layer, or something like that,
00:15:02,734I'll link to the actual page I found,
00:15:05,205so I can give credit, and I found an expression
00:15:08,187that does exactly this, you take two points,
00:15:10,805and it gives you the angle between them, and it's perfect.
00:15:13,977So what I'm gonna do is just come over here and I'm gonna
00:15:15,738copy that, right outta this,
00:15:21,295and paste it in there,
00:15:24,666alright, and there's some extra stuff on the,
00:15:27,218on the end here I need to get rid of,
00:15:29,856alright, so lemme walk you through the second part of this,
00:15:32,415so we have point one and point two,
00:15:34,367what we need to find is the difference in X and Y,
00:15:38,228between point one and point two, alright?
00:15:40,296So what happens next is a variable called delta is created,
00:15:45,273delta is the, the result of subtracting point one,
00:15:51,088and point two, or subtracting point two's position
00:15:54,089from point one's position.
00:15:56,378Now, point one and point two both have an X and a Y value,
00:15:59,956so you could separate the X and Y out,
00:16:03,217and subtract each one separately.
00:16:05,278What this expression does, sub, is it just does that
00:16:08,418all in one go for you.
00:16:10,067Sub can take variables that have more than one value,
00:16:13,704like an X and a Y, and it can subtract the Xs and the Ys,
00:16:17,508all on one thing.
00:16:19,018Then, once you have that, you use
00:16:23,178you know, if you're like me, you didn't even remember
00:16:25,206that this existed, but you have to use an arc tangent,
00:16:29,787which is a way of figuring out an angle,
00:16:33,397based on the length of two sides of a triangle.
00:16:36,657You don't really need to know that,
00:16:37,879all you need to know is that,
00:16:38,988this expression works, and you can copy and paste it in,
00:16:41,436and you're good to go.
00:16:43,136So, we have the difference between point one and point two,
00:16:46,447we get the angle of a, between those two points,
00:16:50,267using this math arc tangent expression,
00:16:53,117then we have to convert the result of that
00:16:55,738from radians into degrees.
00:16:59,846And if you're not familiar with radians,
00:17:01,157radians is another way of expressing an angle,
00:17:03,806it's based on pi, and when you're doing math,
00:17:07,527you know geometry a lot of times works in radians,
00:17:09,928not in angles, so,
00:17:12,458this converts it into degrees,
00:17:14,369because this rotation property is expecting degrees,
00:17:18,807and then, I can erase this little plus zero thing here,
00:17:23,407and then this, and then it's taking the negative
00:17:26,919of that angle, and it's doing something with a percent sign,
00:17:30,977a 360, I'm not exactly sure, I'd have to look that up, but,
00:17:34,457the result of that is now that this,
00:17:37,879this rotation property actually matches
00:17:40,888the angle that this layer is traveling at,
00:17:43,524and to prove it, if I scale the height,
00:17:47,088not the height, the width,
00:17:48,568you can see that it's kind of, perpendicular to that, right?
00:17:52,867So it's not lining up exactly just yet,
00:17:57,018but it's, you know, you can see that it does orient,
00:18:00,007and if I add a point here, on this motion path,
00:18:04,865you'll see that this does rotate,
00:18:07,028and it kind of, sorta follows the motion path, alright,
00:18:10,337so when I had this, I knew I was kinda close,
00:18:14,308but not really close, like,
00:18:16,618I had figured out something, but I wasn't sure what,
00:18:19,885and so, let's just get rid of this negative sign
00:18:22,008and see if that fixes it,
00:18:24,265and oh my goodness, look at that, it fixes it, alright?
00:18:26,606This, I'm walking you guys through my though process,
00:18:29,598and sort of, the trials and errors that I went through
00:18:31,906when I made this, okay?
00:18:33,626So now we've got something kinda useful here.
00:18:35,884Alright, it's actually orienting along the path,
00:18:38,575all by itself.
00:18:40,386Alright, so let's, let's set this width back to 100.
00:18:44,148Now, I've realized that, this ball
00:18:47,898doesn't have a lot of detail,
00:18:50,002and it's gonna make it kinda hard to tell if this expression
00:18:52,800is really working, so before I went too far,
00:18:56,042I decided to add a stripe to it,
00:18:59,142and so, you know, I could show you how to do that
00:19:02,245with shape layers, actually I'm going to,
00:19:04,453cause this is the bonus tutorial,
00:19:06,544because you guys were nice enough to sign up
00:19:08,102for the email list, so I'm gonna do that really quickly.
00:19:10,825So, what's great about a shape layer,
00:19:12,624and why don't I just rename this ball,
00:19:15,771make it kosher, what's great about shape layers
00:19:18,293is you can have multiple shapes within the layer.
00:19:22,673So, what I'm gonna do is, with this selected,
00:19:25,433I'm going to add a rectangular shape here,
00:19:28,992you can see I'm getting some crazy stuff here,
00:19:31,694because this layer is rotated, which is fine with me,
00:19:35,452so now I have a rectangle, and an ellipse,
00:19:38,764and what I need to do is, first, make this rectangle
00:19:42,032a different color, so I can,
00:19:44,497I can see it, so let's take this, let's just make it white,
00:19:47,109okay, and then, I need to crop it,
00:19:50,689so it only shows up within that circle, alright,
00:19:53,938so shape layers work a lot like Adobe Illustrator,
00:19:57,169you can actually merge paths the same way
00:20:00,260and get some cool compound shapes.
00:20:02,199So what I'm gonna do is add an empty group,
00:20:06,616alright, and I'm gonna call this group stripe,
00:20:10,410inside of that group, I need my rectangle path,
00:20:14,020and I also need a copy of my ellipse path,
00:20:18,719so I'm gonna duplicate that ellipse path,
00:20:20,240and bring it up here.
00:20:22,890Put it inside of that stripe group.
00:20:25,442And then what I'm gonna do is, inside of the stripe group
00:20:28,832with it selected, I'm gonna add
00:20:31,061a merge paths, alright?
00:20:34,001And when I do this,
00:20:38,950you can have different modes, so right now it's set to add,
00:20:42,087I want intersect, so it's basically giving me a new shape,
00:20:45,486where these two paths intersect, and then that merge paths
00:20:50,835comes with its own stroke and fill,
00:20:52,826I don't want the stroke, I do want the fill,
00:20:55,287and I want that fill to be a different color,
00:20:56,767and look at that, now we have a white stripe on the ball,
00:20:59,458it's all in one layer, and we're good to go, okay?
00:21:03,597And what's great about this, is that if I had this ball
00:21:07,198rotating, it will rotate as it goes along the path,
00:21:13,620but if it's being stretched by the expression,
00:21:17,146it will stretch, sort of as it's being rotated,
00:21:20,727so you see this is the power of using this transform effect,
00:21:24,527you can sort of, combine and make these compound transforms
00:21:29,121that would be really tricky to do any other way.
00:21:31,551Alright, so now we have our ball,
00:21:34,081and our rotation expression appears to be working, aright?
00:21:37,732Now here's, here's what was throwing me, okay?
00:21:42,451I don't actually want the layer to auto-orient, okay?
00:21:47,841And now that the stripe is on there,
00:21:49,345you can see the problem.
00:21:51,312If I, let's say I have a ball,
00:21:53,271and I want it to do, just like a bouncing animation, right,
00:21:57,410just like this, I don't actually want that ball
00:22:00,330to rotate along the path, right, that's not what balls do,
00:22:04,523I wanna be able to control that myself.
00:22:07,343But, I do want it to stretch along that, okay?
00:22:11,833So, that left me with a conundrum, alright?
00:22:16,012So what I realized needed to happen was, I need to
00:22:21,721rotate the layer, then scale it
00:22:25,561so that it's scaled on the right direction,
00:22:27,209but then un-rotate the layer,
00:22:29,439so that I can actually handle the rotation of the ball,
00:22:33,651or whatever the layer is, by myself, and not have
00:22:36,762the expression do that for me, alright?
00:22:39,972You know, I want this ball to basically stay oriented
00:22:43,351however I tell it, until I change it.
00:22:46,642So, that's when I came up with the idea
00:22:49,609of separating these transform effects into different parts,
00:22:54,072so I could control each part separately.
00:22:56,043So the first part is rotating the layer
00:22:58,775in one direction, okay?
00:23:01,243Now let's duplicate this.
00:23:03,722And we'll call this transform effect scale,
00:23:06,733alright, so what I'm gonna do is hit U, so I can open up
00:23:11,588my expressions here, and I'm gonna delete
00:23:14,633this rotation expression, okay?
00:23:17,910So what I want this second effect to do
00:23:21,899is to either scale or squash or stretch this, right?
00:23:27,163So, it's, it has been rotated, right?
00:23:33,091And I know this isn't gonna make sense until
00:23:34,629the next step too, so lemme, lemme just go ahead
00:23:37,841and add my next rotation, so I have
00:23:40,73001 rotate, 02 scale,
00:23:43,35503 un-rotate, alright?
00:23:46,637And so what's gonna happen is, the first step rotates it,
00:23:49,427the second step is gonna stretch it,
00:23:51,719and it's gonna stretch it in the wrong direction,
00:23:54,218but then it will un-rotate it, and now it will be stretched
00:23:56,676back in the right direction,
00:23:59,048and this, this goes back to, you know,
00:24:01,338the Flame class I took, and I have to tell you,
00:24:04,367professionally, I have never used a Flame,
00:24:06,698but I learned something useful in that class,
00:24:08,919you never know what you're gonna take away
00:24:11,198from learning stuff.
00:24:12,977So, on the un-rotate, this is gonna be
00:24:15,507a really simple setup, this rotation,
00:24:20,837this whole rotation expression here, we can just get rid of.
00:24:24,016All we need to do, alright, and what I'm gonna do
00:24:26,688is I'm gonna hit the Tilde symbol,
00:24:28,985so if you, if you guys don't know,
00:24:31,294the Tilde key, wherever your mouse is over,
00:24:36,197when you hit it, it will make that temporarily
00:24:39,047take up the whole screen, it's a very useful shortcut.
00:24:42,948So I basically want this un-rotate to just,
00:24:45,784negate whatever's going on with this rotate.
00:24:48,506So if I hit option,
00:24:51,899click on rotation here,
00:24:55,967and I pick whip to this,
00:24:59,358but then I come to the beginning and add a negative sign,
00:25:02,269there we go, then I'm gonna hit Tilde again,
00:25:05,190so now what's happening is the ball,
00:25:07,779is not actually rotating along the path anymore.
00:25:11,979However, if I go to now,
00:25:14,808if I go to 02 scale and scale it,
00:25:19,429alright and you can see now
00:25:20,447we're getting some interesting stuff,
00:25:21,925we're getting this perpendicular bend, which is not right,
00:25:25,226however, it is orienting to the path, right?
00:25:30,746Now why is it rotating backwards, alright?
00:25:34,316So this was the problem I ran into.
00:25:36,910And I realized that what's probably happening is,
00:25:40,063it's the order that I'm rotating things in,
00:25:42,513I'm rotating it one way, then I'm rotating it back
00:25:44,754the other way, and whatever I'm doing
00:25:47,285is making it rotate backwards, okay,
00:25:49,264and you can even see here, as it comes over this hump,
00:25:52,573it spins completely the opposite way
00:25:54,314you would expect it to.
00:25:56,465So, what I did was, I came into 01 rotate,
00:26:01,745and I just took a look at this rotation expression,
00:26:04,962and was, and I just, outta curiosity, I thought
00:26:06,885"What if I put a minus symbol in front of this?",
00:26:10,350and whoa, would you look at that?
00:26:12,502And now, we're good to go.
00:26:14,743Alright and you can see that what's cool is
00:26:16,763it is orienting along that path,
00:26:19,732however, this stripe in the middle of the ball
00:26:22,191is staying flat,
00:26:25,251it's not actually changing its angle at all, alright,
00:26:29,961so if I, if I go into scale here,
00:26:33,101and I turn the width down so it's not so extreme,
00:26:37,272right, you can see that
00:26:39,211that layer, it retains any transforms I have given it,
00:26:43,841and all it's doing is stretching along the path, alright?
00:26:47,083So, what I've basically done is built my own skew here
00:26:50,743that can skew that layer at any angle,
00:26:52,844by rotating it, then scaling it, then un-rotating it.
00:26:57,064And it gets its rotation automatically
00:26:59,203by choosing the point directly before and directly after
00:27:03,055the current position of the layer,
00:27:05,026and using a little geometry, alright?
00:27:06,832So now, we, we've kind of gotten close,
00:27:10,394and when I realized this was working was when I said,
00:27:13,283"Well, what if this, this ball is rotating", right?
00:27:16,583If I give it its own rotation along this motion path,
00:27:20,231and just have it rotate a little bit.
00:27:22,792You can see that it's rotating, and as it's rotating
00:27:25,537it's still stretching, which is just awesome, okay?
00:27:30,820So now, we actually have the rig,
00:27:34,271this is the basis of this rig.
00:27:37,571The rest of it was just creating some controls.
00:27:40,836So what I, what I knew was, I wanted a control
00:27:43,299for the squash and stretch amount,
00:27:46,171so I added an expression control, slider control,
00:27:51,671alright, and I just called this SS amount,
00:27:56,042move it up to the top, and I set it to 100,
00:28:01,241and the way I rigged this up was,
00:28:04,581I tied the width, the scale width to this slider, alright?
00:28:09,492So, that's really easy, all you gotta do
00:28:11,623is option click that, and then drag this up to slider,
00:28:15,842alright, and so now this slider
00:28:17,341controls the squash and stretch amount.
00:28:20,603Okay, so stretch, squash, okay?
00:28:25,224Now of course, as I showed you in the previous tutorial,
00:28:27,813when I stretch something out,
00:28:29,996I want it to squash, by an equal amount so that
00:28:33,853the total volume of that layer doesn't change.
00:28:37,296So I need to put an expression on height,
00:28:39,603that looks at the width and adjusts itself accordingly.
00:28:42,867Alright, so what I did was, I added an expression to height,
00:28:46,014and I said W for width, equals,
00:28:50,024whatever this width is, alright, so now, let's make this,
00:28:55,275let's make this an easy example, alright?
00:28:57,067So, if I'm scaling the width to 150,
00:29:01,878what does the height need to be?
00:29:03,317Well, the height needs to be 50, because I've added 50
00:29:06,118to the width, I need to subtract 50 from the height.
00:29:09,526So, I had to kinda figure out in my head, how do I,
00:29:14,086how do I figure that out?
00:29:15,514So, what I basically wanna do is,
00:29:17,627take the difference between
00:29:21,298the normal width, which is 100%, and the changed width,
00:29:25,597so whatever that difference is,
00:29:27,607I need to subtract that from 100, okay?
00:29:33,257So, if the width is 150,
00:29:36,656then what that means is,
00:29:39,184I have added 50 to the width,
00:29:42,204I'm gonna subtract 50 from the height, okay?
00:29:44,837So, the height starts at 100, the same as the width,
00:29:49,174alright, and from that I'm going to subtract,
00:29:52,346and now I need to find the difference,
00:29:54,215so the difference is going to be,
00:29:56,494whatever the width is set to, minus 100.
00:30:02,685Okay, so there we go,
00:30:05,175so now when I set the width to 150,
00:30:08,644the height goes to 50, okay?
00:30:10,316If I set the, if I, if I go even longer,
00:30:14,663then the width, ya know, if I set the width to 190,
00:30:18,544the height becomes 10.
00:30:21,374And an easier way to have done this
00:30:23,246would just be subtract whatever the width is from 200,
00:30:26,976but, ya know, I didn't think of that
00:30:29,205when I was coming up with this, I came up with this,
00:30:31,674this much sillier equation here, so,
00:30:34,495and then the great thing is, if this is less than 100,
00:30:37,002if it's 50, then it increases the height, okay?
00:30:40,844So this is now gonna totally create this
00:30:44,304squash and stretch effect for us.
00:30:46,784Alright, so now we have a control.
00:30:50,799And, at that point I said, "Well shoot,
00:30:52,895"I'm ready to start animating, and I think, you know,
00:30:56,784"I think that's about it, that's great",
00:30:59,304so as I started animating the ball bounce, I found
00:31:03,276some issues, alright?
00:31:04,365So why don't we, just do a quick little,
00:31:08,785maybe one bounce here, okay?
00:31:10,201So the ball's gonna start here,
00:31:12,754I'm gonna separate the dimensions,
00:31:15,471alright and I'm just gonna do the Y position first,
00:31:18,460alright we'll go forward 10 frames and it's gonna fall,
00:31:22,212and then we're gonna go forward, let's say six frames,
00:31:24,901and it's gonna come up about halfway, okay?
00:31:28,150So, let's just quickly do the curves for this,
00:31:32,237and try and fly through this,
00:31:35,778alright, so it's gonna
00:31:38,512accelerate til it hits the ground, it's gonna pop back up,
00:31:42,312ease into that position, alright, so,
00:31:44,988just like that.
00:31:47,011Now, at the same time,
00:31:50,990I'm going to animate the X position,
00:31:53,771so that we actually get a little bit of a bounce, alright?
00:31:56,938There you go.
00:31:58,761Perfect, now if we put squash and stretch on,
00:32:02,781it's going to orient itself along the drop now.
00:32:06,531Now the problem is, when it hits the ground,
00:32:08,328it's gonna squash, and you can see
00:32:11,342that, because of the way it's measuring the angle,
00:32:13,741it's looking one frame backwards and one frame forwards,
00:32:17,311it's not gonna get the exact angle right,
00:32:20,612all the time, it's gonna be really close,
00:32:22,960and for most cases, it's fine.
00:32:24,829But for extreme cases, like a ball hitting the floor,
00:32:28,140or something changing direction drastically really quickly,
00:32:33,116it's not gonna be the right angle,
00:32:34,575so I needed a way to adjust that, alright?
00:32:37,956So that's when I decided to add
00:32:40,504another expression slider.
00:32:41,996So what I did was I duplicated SS amount,
00:32:45,656and actually I'm gonna do this a different way now,
00:32:47,526I'm gonna use a,
00:32:49,766I'm gonna use an angle control here, alright?
00:32:52,965So this angle control, we're gonna call SS angle
00:32:58,227offset, okay?
00:33:00,374Now what is this going to drive?
00:33:02,664It is going to drive the initial rotation, alright?
00:33:06,537So let's hit U on this ball,
00:33:09,275go into the rotation expression,
00:33:12,246And basically, all we need to do is
00:33:13,601leave this part the same,
00:33:15,441but then add whatever the value of this offset is, alright?
00:33:18,651So if the offset's zero, it's not gonna effect it at all.
00:33:21,730If it's not zero, it is gonna effect it,
00:33:23,440and it'll be something we can control.
00:33:25,359So what I'm gonna do is say,
00:33:26,949plus click and pick whip,
00:33:30,859to this, add a semicolon, and we're good,
00:33:34,139so now this angle offset is going to allow me
00:33:37,149to keyframe and, and sort of, you know,
00:33:40,629create some nice, flat shapes, alright,
00:33:45,252for the ball.
00:33:46,863Alright, so it's gonna be zero here,
00:33:51,812and, lemme just go ahead and start keyframing this, so,
00:33:54,833at the beginning of this animation, the ball
00:33:57,062is not moving, alright?
00:33:58,743As it approaches the fastest point
00:34:00,936of its animation, which is this frame,
00:34:02,990it's gonna stretch out to its maximum stretch,
00:34:05,940whatever that's gonna be, 130 let's say, alright?
00:34:09,796When it hits the ground, it will immediately compress.
00:34:12,664So, it will now go less than 100,
00:34:14,933so let's say it goes to 80,
00:34:17,104or it could compress a lot, let's say 60.
00:34:19,775Alright, so now the angle's wrong,
00:34:21,553so what I'm gonna do is go back one frame,
00:34:24,204put a keyframe there, go forward one frame,
00:34:26,834and adjust this, until it's right, okay?
00:34:30,784And then on the next frame, I'm gonna reset this,
00:34:34,403and then it's gonna stretch out a little bit,
00:34:38,264as it reaches the fastest point,
00:34:40,809it's gonna stretch out the most,
00:34:44,190and then as it reaches the top, it's gonna go back to 100.
00:34:48,434Okay, so if we RAM Preview this,
00:34:52,568there we go, you see we've got our nice little
00:34:54,257squash and stretch bouncing animation going, okay?
00:34:58,728Now, when I started actually animating this on
00:35:02,700my background, which had a floor,
00:35:05,129that's when I noticed
00:35:07,600that when you squash the ball,
00:35:08,978it's squashing from the center point of the ball,
00:35:12,879when in reality, the ball's gonna squash
00:35:15,329from the bottom of the ball.
00:35:17,148Wherever it makes contact with the floor,
00:35:18,931that's the anchor point of the squashing.
00:35:22,732So, I needed to be able to adjust that as well.
00:35:26,297So then, I duplicated SS Amount,
00:35:29,447and I called it SS
00:35:32,187Y Offset,
00:35:35,145let's turn off keyframes, set this to zero.
00:35:38,083Alright, so now I need a way, (laughing)
00:35:41,835you can see the rabbit hole that you go down
00:35:43,687when you start building rigs like this.
00:35:46,357I needed a way to actually shift the position of this layer
00:35:50,836down by a little bit, or up, depending on what it's doing.
00:35:54,815So, I decided the easiest way would just be add another
00:36:00,235transform effect, so I just duplicated this one here.
00:36:05,595And let's name this 04 Y Offset.
00:36:11,331I'm gonna hit U on this, I'm gonna hit my Tilde key,
00:36:15,042you can see we have a lot of expressions going on now,
00:36:17,151so on the Y offset transform effect,
00:36:19,753I'm gonna delete this rotation expression,
00:36:22,787we don't need that,
00:36:24,069what we're actually going to change
00:36:28,353is the position,
00:36:30,750so what we're gonna do is,
00:36:34,219start with whatever the position is,
00:36:36,895and then add whatever the Y offset is,
00:36:39,620to this Y value, alright?
00:36:41,820So the way to do that, is,
00:36:44,797we're gonna adjust the position expression here,
00:36:48,507alright, and I'm gonna create a variable,
00:36:50,213so I'm gonna say original equals this layer position.
00:36:57,555So, now what we wanna do,
00:36:59,568is get this Y offset, so then we'll say Y off,
00:37:05,099I'm just making these variable names up,
00:37:06,688Y off, is now whatever this slider's set to.
00:37:10,870Alright, so now the value of this position is going to be
00:37:15,520we're gonna open it with brackets,
00:37:17,099because it's expecting an X and a Y,
00:37:19,416and whenever a property expects two values,
00:37:22,280you have to bracket them.
00:37:23,776So we're gonna open the brackets,
00:37:25,380and first it wants the X value.
00:37:27,488So the X value is going to be
00:37:30,457the original position
00:37:33,568but the, the first value of the original position,
00:37:36,478which will be the X value.
00:37:38,247In After Effects, when you have two values,
00:37:40,098the first one is
00:37:42,170is numbered zero, and the second one is numbered one,
00:37:46,530so it's kinda confusing, but you just need to know that
00:37:48,496when you're counting in After Effects, you start from zero.
00:37:52,199So that first value original bracket, zero,
00:37:55,179that's actually saying, the original layer position,
00:37:58,728X value, then comma,
00:38:02,373original one,
00:38:04,806so now the Y value, plus Y offset.
00:38:10,157So, we're basically taking the original position,
00:38:13,207feeding it back but adding a Y offset to the Y value, okay?
00:38:17,596So now, if I adjust this, this layer,
00:38:22,502you know it will still move,
00:38:24,179if I zoom out so you can see this whole thing,
00:38:27,253the layer still moves, exactly as it did before,
00:38:29,934and it's still stretches and scales
00:38:31,622and follows the motion path,
00:38:32,932but it is now offset on Y, and this is keyframable,
00:38:36,156so normally it's gonna be at zero,
00:38:38,695so one frame, on this frame, the Y offset is zero.
00:38:42,783Go forward one frame, and we're just gonna tweak it,
00:38:45,885so now it's touching the ground,
00:38:47,745go forward one frame,
00:38:49,525and it's zero, so there ya go,
00:38:51,075that's, that's how it works, alright?
00:38:53,426It's that simple.
00:38:57,025Alright, and the last thing I added
00:39:00,835for this rig, was the ability to have a global,
00:39:05,944sort of multiplier, so that if you wanted more or less
00:39:08,446squash and stretch, you could easily globally apply that.
00:39:12,594So, let's duplicate this,
00:39:15,163call it SS multiplier.
00:39:19,684Turn off keyframes, and we'll set this to one, alright?
00:39:22,202So, if you multiply something by one, it doesn't change,
00:39:24,964so that's where we're gonna start it.
00:39:27,213So what is this going to effect?
00:39:28,822This is going to effect,
00:39:32,035the scale transform, okay?
00:39:34,588And really all we need to worry about is
00:39:37,267the width, because the height has an expression on it
00:39:40,056that reacts to the width, alright?
00:39:41,980So let's go down here, let's find that expression,
00:39:44,523so here's scale, and here's width, okay?
00:39:48,014So here is my width expression.
00:39:51,544And this is when I wish I had a,
00:39:54,183sorry my height expression.
00:39:56,374This is when I wish I had a bigger monitor, or maybe,
00:40:01,253you know, maybe two monitors, or something like that.
00:40:04,711Okay, so the width here
00:40:08,772the width is looking at the SS amount slider, okay?
00:40:12,112So really all we need to do is multiply that
00:40:16,013by the multiplier, alright?
00:40:18,132So if the width is set to,
00:40:21,227you know, 100,
00:40:24,101and you multiply it by one, nothing's gonna change.
00:40:26,850If you multiply it by two, what's it gonna be?
00:40:29,120It's gonna be 200.
00:40:30,931As I'm saying this to you,
00:40:32,530I'm having the same revelation I had the other night
00:40:34,791when I made this expression, that,
00:40:36,810that actually isn't gonna work either,
00:40:38,741because what I actually want
00:40:40,898is I want that multiplier to effect just the change
00:40:45,040in squash or stretch.
00:40:46,500So, when that, when this SS amount is set to 100,
00:40:51,539this multiplier shouldn't have any effect on it,
00:40:53,971because when there's no squash or stretch going on,
00:40:57,219it should be unaffected.
00:40:58,821But as soon as you get some squash or stretch,
00:41:01,428then it will start to be effected.
00:41:03,171So how're we gonna do that?
00:41:05,090Alright, so, again what we,
00:41:08,235what we really need to effect is the difference between
00:41:11,960the default value of 100,
00:41:14,488and whatever the new value is, okay?
00:41:17,138So, what we're gonna do is we need to measure,
00:41:19,779what is the amount of squash and stretch?
00:41:21,959So let's make a variable, amount equals
00:41:26,839this, the value of the SS amount slider, okay?
00:41:31,280So then, what we can say is,
00:41:33,050now we need to measure the change in that,
00:41:36,438in the squash and stretch, you know,
00:41:38,275as opposed to no squash and stretch.
00:41:41,196So, because we're, we're starting at 100,
00:41:44,705if we're gonna stretch, we're gonna go up to, say, 150,
00:41:47,257the change is 50, that's what we need to measure.
00:41:50,246So what we need to do is say the change,
00:41:52,946so I'm gonna use D for delta,
00:41:55,305so D equals
00:41:58,167the amount minus 100.
00:42:01,856Alright, so if we have stretched to 150,
00:42:04,566this will give us a D of 50.
00:42:07,696Now I'm going to multiply D times this multiplier, okay?
00:42:13,237So now the multiplied amount, I'm just gonna put mult,
00:42:16,647mult equals the, mult equals D,
00:42:21,767times the multiplier.
00:42:27,482So what we've done is we've figured out the change
00:42:29,183in squash and stretch, and now we've multiplied that
00:42:32,094by, by default by one, doesn't change anything,
00:42:34,695but if I change that to 2, now it's gonna change
00:42:38,474twice as much, but if it's not changing at all,
00:42:41,173if it's still set to 100, nothing will happen, okay?
00:42:44,314And then what we want to return here
00:42:46,621is 100 plus that result of mult, okay?
00:42:51,804So now, when this is set to 100, nothing happens, okay?
00:42:55,433And let's just play this bouncing animation,
00:42:56,862so you can see what's going on, alright?
00:42:58,829Now in the middle of this bouncing animation,
00:43:00,334if I change this to two,
00:43:02,396it's gonna stretch twice as much.
00:43:04,605But if we go back to the beginning,
00:43:06,707it's still completely untouched, okay?
00:43:09,156That's cause this multiplier is now only effecting
00:43:11,925the change in squash and stretch, okay?
00:43:15,777So now, you can see it's a lot more exaggerated.
00:43:18,994And you can crank this up, alright?
00:43:21,077If I set it to three, you're seeing I'm getting a really
00:43:24,716thin, kinda goofy, and then when it hits the ground,
00:43:27,007it really splats, becomes like a pancake.
00:43:29,787So it's too much.
00:43:30,803And then, this also works if you go less than one.
00:43:33,865If you wanna decrease the squash and stretch, alright?
00:43:37,052And I guess if you wanted to,
00:43:38,097you could even keyframe this, alright?
00:43:40,335So by default that's at one,
00:43:42,544but that is kind of a global factor
00:43:44,225for your squash and stretch.
00:43:47,206Alright, so
00:43:50,335I think this rig is done, I think that's truly,
00:43:52,535that's, it seemed a lot simpler this time around
00:43:54,684cause I knew how to do it.
00:43:56,375So, there you go, that is how I built this rig,
00:43:59,536and if I wanted apply this
00:44:02,644to anything, all I have to do
00:44:04,966is copy all of these effects
00:44:07,636onto a different layer, alright?
00:44:09,044So let's just do a quick test.
00:44:10,786Just to make sure
00:44:12,756that this works the way I think it does,
00:44:15,235so let's hide the ball,
00:44:17,164and let's make something that's not as obvious,
00:44:19,766let's make a star.
00:44:21,284Something like that, okay?
00:44:23,368And I'm gonna move the anchor point of that star
00:44:26,526into the middle, okay?
00:44:30,434And I'm just gonna do a quick
00:44:35,045quick little animations here,
00:44:36,404so it's gonna start here,
00:44:38,274gonna go forward,
00:44:42,173let's go 20 frames,
00:44:44,013it's gonna come over here.
00:44:46,622You can see the anchor point's all messed up,
00:44:49,455so why don't we fix that?
00:44:52,613There we go.
00:44:55,042Alright, so position,
00:44:57,344go forward 20 frames,
00:44:59,861move it,
00:45:02,734then we'll go another 20 frames,
00:45:05,911come back the other way,
00:45:11,854I'm having all kinds of trouble here, people,
00:45:13,450here we go, alright.
00:45:15,883And then we'll, we'll just
00:45:17,422use the default Easy Ease on those,
00:45:20,335save ourselves some time, alright?
00:45:21,362So here's what our star's doing, okay?
00:45:24,694And now I'm gonna come here,
00:45:27,394I'm gonna disable all of these
00:45:31,074stopwatches, so we're kind of at the default values here,
00:45:34,484I'm just gonna select all of these and copy them
00:45:38,443onto the star, okay?
00:45:40,414So we come here,
00:45:42,463put a keyframe on squash and stretch amount,
00:45:45,694as it gets to the middle it's gonna stretch out,
00:45:47,843and you can see it is stretching out in the right direction,
00:45:52,515and then as it comes here, I'm gonna have it,
00:45:57,310I'm actually gonna have it squash a little bit.
00:46:02,953Just a little, cause it's kind of decelerating,
00:46:09,321and then it's gonna come back, stretch out again,
00:46:13,254and as it gets to the end, it's gonna squash,
00:46:16,031just a little,
00:46:19,732and then it's gonna reset back to 100.
00:46:24,002Alright, so just that quick,
00:46:26,782you've got this thing squashing and stretching and,
00:46:29,899and reacting in the direction it's moving.
00:46:33,432And, especially with something, you know,
00:46:35,440with like a complex contour, like a star,
00:46:37,852this would be very hard to do,
00:46:40,450without a rig like this, you'd have to,
00:46:43,030either animate masks, or you'd have to
00:46:45,201try and get it to work with the skew, but then,
00:46:47,962let's say you had the star move straight up and down,
00:46:50,101or left and right, it wouldn't work, so,
00:46:52,162with this rig, this makes it very, very simple.
00:46:55,012So there you go.
00:46:56,007Thank you guys so much, and I will talk to you soon.
00:46:59,580Thank you so much for watching, I hope this lesson gave you
00:47:01,940a good understanding of the animation principle
00:47:04,621of squash and stretch.
00:47:06,041If you wanna know more about how to use the principles
00:47:08,482of animation to really take your work to the next level,
00:47:11,292make sure you check out our animation boot camp course,
00:47:14,163for an in-depth learning experience,
00:47:16,052focused on teaching you the craft of animation.
00:47:19,062If you have any questions or thoughts about this lesson,
00:47:21,352let us know, and we'd love to hear from you,
00:47:23,700if you use this technique on a project so,
00:47:26,280give us a shout on Twitter, @schoolofmotion,
00:47:28,928and show us your work.
00:47:30,071Thanks again, and I'll see you next time.
00:47:33,080(synthetic electronic jingle)