🎉 Spring Registration is OPEN! 🎉
00
DAYS
00
HOURS
00
MINUTES
00
SECONDS
REGISTER NOW
Back to Blog Index

How to Use the Loop Expression in After Effects

Using the loop expression in Adobe After Effects.

Today we’re talking about one of the most useful expressions in After Effects, the loop expression. This tutorial and article will share everything you need to know to get started with creating loops in After Effects. So buckle up and grab notebook, it’s Groundhog Day at School of Motion.  

LET’S GET A LITTLE LOOPY…

To help explain the benefits of the loop expression, we’ve put together a tutorial that will walk you through some real-world uses of loops.

{{lead-magnet}}

What is the Loop Expression?

A loop expression does exactly what the name implies, it loops a series of keyframes. However, there's a lot more to the loop expression than simply cycling between the first and last keyframes. Loops can help a ton when working with walk cycles, logo reveals, background design, and more.

EXAMPLES OF LOOP EXPRESSIONS

  • loopOut();loopIn(“pingpong”);
  • loopOut(“offset”,2);
  • loopOutDuration(“cycle”,3);

LOOP EXPRESSION BREAKDOWN

A loop expression can be broken up into 3 distinct parts: The Property, Loop Type, and Modifier. Understanding each part is important for getting the most out of your loops. So we’re going to talk about each part in excruciating exciting detail.

LOOP PROPERTY

There are technically 4 different types of loop expression properties but we’ll take about the other two at the bottom of this post. The main two properties that you will want to know about are the loopOut and loopIn properties. Both loop properties essentially do the exact same thing with one key difference:

  • loopOut(); Loops beyond the last keyframe
  • loopIn(); Loops before the first keyframe

Both have their own potential use-cases, but for 90% of the projects that you work on you’ll want to use the loopOut property.

The Loop Types

Not all loops are created equal. There are actually 4 different types of loops that can change the way your loop works in After Effects. To change your loop type all you have to do is add “loopname” to the inside of your parentheses. Like this: loopOut(“pingpong”);

Here’s a breakdown of each loop type:

CYCLE

Examples:

  • loopOut(); or loopOut(“cycle”);
  • loopIn(); or loopIn(“cycle”);

The cycle loop simply repeats your keyframes forever and ever. Once a loop approaches the last keyframe it will jump right back to the first keyframe. By default a loop property without a type defined will be a cycle.

PINGPONG

Examples:

  • loopOut(“pingpong”);
  • loopIn(“pingpong”);

As the name implies the “pingpong” loop type goes back and forth between your first and last keyframe. From start to finish and finish to start, over and over again.

OFFSET

Examples:

  • loopOut(“offset”);
  • loopIn(“offset”);

The Offset loop type simply builds on itself by adding or subtracting the ending value from the starting value and applying the difference to your final or opening keyframes. That explanation is admittedly confusing, but just look at the example above. As you can see the offset continues the loops movement without reverting back to the original start value. In my opinion the Offset loop type is the most powerful and potentially useful loop type, but it never gets the love it deserves.

CONTINUE

Examples:

  • loopOut(“continue”);
  • loopIn(“continue”);

The “continue” loop type is really specific, but it’s still pretty cool. Essentially the continue loop continues the speed/value of the final keyframe. So if your loop ended with a rotation speed of 30 degrees a second that speed would continue beyond the final keyframe. Nothing else happens, just continued inertia... forever. #NewtonsFirstLawofMotion

Note: You can see a visual representation of the continued motion of the loop in the graph editor (called the post expression graph) by selecting the small graph button to the left of the expression window.

Post Expression Graph Example.png

ARGUMENT MODIFIER

The last thing that you can add to your loop expressions is an argument modifier. While the name sounds really scary it’s actually not that difficult to understand. Essentially an argument modifier will tell After Effects which keyframes you want to loop. For example, if you had a sequence with 5 keyframes you could tell After Effects just to loop the last 2. This is done by simply adding a comma and a number.

The number tells After Effect how many keyframes should be included in the modified loop. For example, a loopOut property with a modifier of 1 will only include 2 total keyframes: the last keyframe and the one before it. Here’s a few examples so we’re on the same page:

  • loopOut(“pingpong”,1); - Will loop between the last 2 keyframes
  • loopIn(“offset”,2); - Will loop between the first 3 keyframes.

Modifiers are actually really easy to use once you get the hang of them. Modifiers can only be applied to the cycle, pingpong, and offset loop types.

DURATION LOOP PROPERTY

Example:

  • loopInDuration(“pingpong”,2);
  • loopOutDuration(“offset”, 4);

Lastly we should talk about two different types of loop properties: loopInDuration(); and loopOutDuration();. Both properties act in a very similar way to the loopIn(); and loopOut(); properties, but with one key difference:

Duration Loop Properties will loop based on time (seconds) when an argument modifier is applied to it. (That was a nerdy sentence...)

Basically if you add a comma and a number after your duration loop property your expression will loop based on seconds instead of keyframes. I don’t find this type of loop to be very helpful in a lot of cases, but it’s there and now you know about it.

SEE YOU LATER! SEE YOU LATER! SEE YOU LATER! SEE YOU LATER! (IT'S A LOOP...GET IT?)

Hopefully you feel ready to add loops to your next After Effects project. Loops really are a fantastic tool that can save you a lot of time. If you want to learn more about After Effects or Motion Design check out our blog where we regularly post exhilarating tutorials.

‍

EXPLORE ALL COURSES ➔

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.

Not sure where to start?

If you’re a beginner, here are some great courses to help you get started:

After Effects Kickstart

Dive into the fundamentals of motion design with our most popular (and recently updated) After Effects course.

LEARN MORE

Photoshop + Illustrator Unleashed

Master the basics of Photoshop and Illustrator and gain invaluable insights in this introductory level course.

LEARN MORE

Design Kickstart

An introduction to the design principles behind all great work.

LEARN MORE

More Advanced?

If you’re a more advanced student looking to up your game, here are some great options:

Animation Bootcamp

Learn the art and principles of creating beautiful movements in Adobe After Effects.

LEARN MORE

Design Bootcamp

Learn to design for motion in this intermediate-level, project-based course.

LEARN MORE

Cinema 4D Basecamp

Learn Cinema 4D from the ground up in this exciting introductory C4D course.

LEARN MORE

Now is the time to learn the skills you need to advance in your motion design career: