Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Quizzler 1 solution: Touching wheels

From: After Effects Apprentice 09: Expressions

Video: Quizzler 1 solution: Touching wheels

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 quick-and-dirty 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%.

Quizzler 1 solution: Touching wheels

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 quick-and-dirty 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 trade-off, a little bit of coding upfront, a lot less work later on.

Show transcript

This video is part of

Image for After Effects Apprentice 09: Expressions
After Effects Apprentice 09: Expressions

20 video lessons · 10808 viewers

Chris Meyer and Trish Meyer
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed After Effects Apprentice 09: Expressions.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.