Article
No items found.

Rotation Expressions in After Effects

by
Ryan Plummer

Ready to have your head spin? Let's take a look at the rotation expression for After Effects.

Today I'm going to show you a few easy expressions that can make a pretty big impact in your animation workflow. Learning how to automate parts of your workflow can really pay off, especially when your client comes back with revisions. This is where expressions come into play.

This will be super helpful if you want to know how to rotate multiple layers using expressions. We'll go over having a layer perpetually rotate, and then dive into how to rotate based off of a layers position!

So, let's dig in and stop setting so many keyframes!

Where are the rotation expressions in After Effects?

To access the expression editor in After Effects click the triangular menu button on the left side of your layer. Then open the transform effects, and there we will find our rotation property. You can also select your layer and press 'R' on your keyboard if you like to use handy keyboard shortcuts. This will bring up the rotation property automatically!

If you're new to expressions then let's also take a second to explain how to start writing an expression.

Start by navigating to the rotation property, then locate the stop watch icon to the right of the word "rotation." Simply hold ALT and click that stop watch icon. There should now be a space to the bottom right of your layer where you can start typing. Here is where we will be placing our expressions and coding in After Effects.

Now, let's get into some cool rotation expressions that you can start adding to your motion graphics workflow!

Constant Rotation with Expressions

One of the most useful ways to make your animation life easier is to have layers animate without much help. By using an expression we can actually have a layer rotate by itself. Not only that, but we can set how fast we would like it to rotate.

First, let's start off with getting a layer to spin by using the time expression. Choose any layer you'd like to manipulate. For this example, I'll just be using a square!

time;

Once you type this small snippet, click outside the coding area and playback your animation. Your layer should be rotating!

Slow Rotation Expression

Seriously though, that's way to slow! You may not have even noticed that it was rotating until the GIF reset. Let's up the speed a little bit to help you get a better idea of what's happening!

time*300;

Fast Rotation Expression

Hopefully you're starting to see how useful this can be! Imagine having a ton of layers, like gears, or a ton of tiny windmills spanning a beautiful German landscape depicting a fairy tale! Whatever your scene, this can definitely save you a lot of time!

I multiplied time by a value of 300, but you can set whatever you need. And, just to be clear, the higher the number you multiply time by, the faster the object will rotate. If you want to learn more about how the time expression works you can check out our previous article covering the time expression!

Rotate a Layer Based on Position

Need to animate a wheel turning on a car but want it to look realistic? To make your life easier, and cut down on keyframes, drive those wheel rotations with the position change of your car!

Let's let expressions take care of the math, and then you can just focus on moving the body of the car. Here is an expression for rotating layers based on a layers position:

thisLayer.transform.position[0] *.8;

Rotation expression based on position

Note that the code above is referencing the position of the same layer you are rotating. If you want to have your rotation follow another layer, then use the expression pick-whip to select the layer's position that you want to reference.

How to expression pickwhip

Rotation Expression Project Download

To show that you really don't need to be a wizz at expressions, I made this quick gear animation that's powered by expressions only! If you want to take a look at it and get the code, download the project below!

And as a bonus, I've placed a clock rig in the project file as well. There you can see the expression used for making each hand on a clock spin properly.

Clock Expression Example.png

{{lead-magnet}}

It's Time for More!

I hope you see the value in using expressions on the rotation property. There are a lot of use cases outside of what I went over in this article, and if you want to learn more about using expressions in After Effects we have a ton of other great expression content here on School of Motion. Here are a few of our favorite tutorials:

Also, if you really love learning motion design, check out our courses page. We've built custom courses designed to get your motion design skills up to speed very quickly. We offer a range of courses for both beginners and advanced motion artists. Tag us on social media (#schoolofmotion) with your expression experiments. Best of luck on all your Motion Design projects!

The All-Access discount is SOLD OUT, but you can still get 25% off all individual courses! We’ve been quietly rolling out our new All-Access program, where you can get every course we make for one low price. It’s a crazy good deal even without this sale. But until Wednesday 12/4, you can get it for 25% off. For this sale we are opening up 100 spots. After those sell out, you’ll have to wait at least a few months until we open more. Don’t sleep on this deal. We expect it to sell out fast.

ENROLL NOW!

Acidbite ➔

50% off everything

ActionVFX ➔

30% off all plans and credit packs - starts 11/26

Adobe ➔

50% off all apps and plans through 11/29

aescripts ➔

25% off everything through 12/6

Affinity ➔

50% off all products

Battleaxe ➔

30% off from 11/29-12/7

Boom Library ➔

30% off Boom One, their 48,000+ file audio library

BorisFX ➔

25% off everything, 11/25-12/1

Cavalry ➔

33% off pro subscriptions (11/29 - 12/4)

FXFactory ➔

25% off with code BLACKFRIDAY until 12/3

Goodboyninja ➔

20% off everything

Happy Editing ➔

50% off with code BLACKFRIDAY

Huion ➔

Up to 50% off affordable, high-quality pen display tablets

Insydium ➔

50% off through 12/4

JangaFX ➔

30% off an indie annual license

Kitbash 3D ➔

$200 off Cargo Pro, their entire library

Knights of the Editing Table ➔

Up to 20% off Premiere Pro Extensions

Maxon ➔

25% off Maxon One, ZBrush, & Redshift - Annual Subscriptions (11/29 - 12/8)

Mode Designs ➔

Deals on premium keyboards and accessories

Motion Array ➔

10% off the Everything plan

Motion Hatch ➔

Perfect Your Pricing Toolkit - 50% off (11/29 - 12/2)

MotionVFX ➔

30% off Design/CineStudio, and PPro Resolve packs with code: BW30

Rocket Lasso ➔

50% off all plug-ins (11/29 - 12/2)

Rokoko ➔

45% off the indie creator bundle with code: RKK_SchoolOfMotion (revenue must be under $100K a year)

Shapefest ➔

80% off a Shapefest Pro annual subscription for life (11/29 - 12/2)

The Pixel Lab ➔

30% off everything

Toolfarm ➔

Various plugins and tools on sale

True Grit Texture ➔

50-70% off (starts Wednesday, runs for about a week)

Vincent Schwenk ➔

50% discount with code RENDERSALE

Wacom ➔

Up to $120 off new tablets + deals on refurbished items

Success! Check your email (including spam folder) for your download link. If you haven't yet confirmed your email with us, you'll need to do that one time.
Oops! Something went wrong while submitting the form.
Featured
No items found.
No items found.