
Easytofollow video tutorials help you learn software, creative, and business skills.Become a member
Your first Quizzler challenge was how to hook up these various pulleys to make them rotate as if they were actually all physically touching. I'll show the quickanddirty way to make this happen and then a trickier way of making it happen. The first thing I need to know is what is the relative size of these different pulleys? Since they all started from the same source layer, the clue is, how are they scaled? I'm going to type Shift+S to review Scale for pulley 1. It is scaled to 100%. Select pulleys 2 and 3, press S, they're scaled to 50% and 25%.
Well, the rule with things like gears and pulleys and tires all this other stuff is that the relationship between your sizes exactly equals the relationships between their speeds. Smaller ones will rotate faster; bigger ones will rotate slower. Now you could copy and paste keyframes and manually edit values, but we showed you earlier in this lesson why that's a bad idea. Let's use expressions. Now before we hook up expressions, we need to actually reveal the parameters we're going to be working with. So I'm going to press Shift+R to also reveal the Rotation.
Make sure only pulley 2 is selected. That's what I'm going to work with first. Hold Option or Alt and enable expressions for pulley 2. Okay, the first thing I know is I want it to be based on pulley 1. That's easy, so I'll just hook that up. The next is I need to figure out what is the relative speed? Well, pulley 2 is half the size of pulley 1; therefore, it must rotate twice as fast. Now, the one another thing to keep in mind, when pulleys or tires or wheels are touching each other, they actually revolve in opposing directions.
I am going to leave this as it is for now, press Enter, and RAM Preview. You can see how this is wrong. They're not supposed to both rotate together, or there would be a lot of friction right at this point. So your last step is to make that second pulley rotate backwards by just putting a minus sign in there. You can also say *1, but that would be unnecessarily complex. RAM Preview and now we have those two pulleys doing exactly the right thing. Now let's hook up this last pulley, pulley 3. I'll select it, Option or Alt, click on stopwatch for rotation.
And I can do a couple of different things. I can go ahead and hook it up to follow the rotation of pulley 1, look at their relative sizes, 25%, 200%, and say, oh, you need to rotate four times as fast, and work through my chain forward, backward, forward, okay, no need to rotate this one backwards. Or, if you wanted, you can go ahead and hook this expression up to the previous pulley's rotation. After all, these are the two that are touching each other. So I'll make it follow that rotation, and say times. Let me see, this pulley is half the size of pulley 2, the times 2 again, they're touching, so they need to rotate opposite directions, times 2. Enter, RAM Preview, and now that works perfectly.
That's great! Yes, you can't have an expression follow another layer that has an expression. You just can't make a big closed circle, because you'd end up with this endless loop, and it just won't work. That's the simple way of doing this, but let me show you the really trick way of doing it, if you want to take your expression skills the next level. I had to do a little bit math here and say 50%, 100%. That's two times, okay. That's what's going on. I could have just let After Effects do the math for me, and I'll show you how to do that. Rather than saying times 2, what I really want it to be is the ratio of the relative scales of those two pulleys.
I am going to calculate that inside parentheses, so those of you who are remembering math, I know you're having bad flashbacks elementary school right now. It's good to group operations inside parentheses, so they are calculated by themselves. I'll do open parentheses and say I want to take the scale of this pulley. You get to choose where to pick the X or Y. They're both the same. It's best just to pick one. You want to pick two dimensions, because things get really confusing, because scale has two dimensions, rotation has one dimension. Let's go ahead and pick, say, the X demission of your wheel.
I'm going to type a space, just to make things easier to read, slash for divide, divided by the scale of this pulley. You'll see After Effects has been writing a lot of code for me, but basically it's looking for the Transform Scale parameters of these pulleys. Close parentheses and the last thing I need to remember is touching pulleys or touching wheels rotate opposite directions. I'll just put a minus sign in front of this whole mess. Press Enter, RAM Preview, and that works as well.
And the really cool part of this is if a client comes along later and says, "Can you change the relative scales of these pulleys?" make the second one smaller or bigger, you would not have to go back and rework your expression. You would not have to refigure out these ratios. Instead, it's doing the math for you already. For example, if I was to make this pulley 60% in size, move it in a way so it touches, move this little pulley in the way that it touches, and now it's out of whack too, so I am going to need to do the same math for this one, times minus the size of that pulley, divided by my own size, close parentheses, Enter, RAM Preview, now they all still rotate at their correct relative speeds, because I'm writing expressions and After Effects do the math for me, rather than having to pull out the calculator every time something changes.
So that's your tradeoff, a little bit of coding upfront, a lot less work later on.