Back to Blog Index

Rotation Expressions in After Effects

No items found.

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!

Dive into real-time 3D with our Unreal Engine beginner's course by Jonathan Winbush. Master importing assets, world-building, animation, and cinematic sequences to create stunning 3D renders in no time! Perfect for motion designers ready to level up.

Explore this Course

Unlock the secrets of character design in this dynamic course! Explore shape language, anatomy rules, and motifs to craft animation-ready characters. Gain drawing tips, hacks, and Procreate mastery (or any drawing app). Ideal for artists seeking to elevate their craft.

Explore this Course

Elevate your freelance motion design career with our guide to client success. Master a repeatable method for finding, contacting, and landing clients. Learn to identify prospects, nurture leads, and develop a thriving freelance philosophy amidst chaos.

Explore this Course

Rev up your editing skills with After Effects! Learn to use it for everyday needs and craft dynamic templates (Mogrts) for smarter teamwork. You'll master creating animated graphics, removing unwanted elements, tracking graphics, and making customizable templates.

Explore this Course

Stand out with Demo Reel Dash! Learn to spotlight your best work and market your unique brand of magic. By the end, you'll have a brand new demo reel and a custom campaign to showcase yourself to an audience aligned with your career goals.

Explore this Course

Illuminate your 3D skills with Lights, Camera, Render! Dive deep into advanced Cinema 4D techniques with David Ariew. Master core cinematography skills, gain valuable assets, and learn tools and best practices to create stunning work that wows clients.

Explore this Course

Master After Effects at your own pace with Jake Bartlett's beginner course. Perfect for video editors, you'll learn to create stylish animated graphics, remove unwanted elements, and track graphics into shots. By the end, you'll be equipped for everyday AE needs and more.

Explore this Course

Revolutionize your Premiere workflow with customizable AE templates! Master creating dynamic Motion Graphics Templates (Mogrts) in After Effects to speed up your team's work. By the end, you'll craft easily-customizable templates for seamless use in Premiere Pro.

Explore this Course
Your download is in your inbox!!!
Check your email (spam, too) for the download link!
Please check the spam folder if you don't see the message within a minute or two. Google likes to hide your downloads, sometimes.
Oops! Something went wrong while submitting the form.