No items found.

Rotation Expressions in After Effects

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!


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!


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


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!

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.
No items found.
No items found.