» Get a 1-month free trial of Skillshare! »
x
Tutorial

Repeat Keyframes with Loop Expressions in After Effects

If you ever find yourself copying and pasting keyframes over and over to make an animation loop, there’s probably a better way, and that’s to use loop expressions.

Loop expressions are one of the most commonly used expressions in After Effects. They’re also easy to understand and use, making them a great expression to learn, even if you’ve never used expressions before.

Using loop expressions instead of copying and pasting the same keyframes over and over also makes it easier to adjust the animation, because there are fewer keyframes to adjust.

In this video:

0:43 - Loop Property

1:34 - Loop Type

7:10 - Loop Modifier

The loop expression has different parts, so you can create different types of looping effects. Let's take a look:

Property

The first part of the loop expression is the property. There are two options:

Loop Out

Repeats the keyframes after the last keyframe.

Loop In

Repeats the keyframes before the first keyframe.

Type

The next part of the loop expression is the type, and there are 4 to choose from: cycle, pingpong, continue, and offset. You can use loopOut or loopIn with any of these types.

Cycle

The cycle loop type plays through the keyframes then starts again at the first keyframe and plays through again, and again...

This is probably the most commonly used type of loop expression. It's also the default which means that if you leave the () empty, it's the same as loopOut(). The same is true for loopIn().

Use Case

There are tons of examples of this loop expression, but here's a simple one: the fish's lips.

You can also loop an entire composition. Usually loopOut("cycle") is what you want for this.

Pingpong

The pingpong loop type animates back and forth between your keyframes. This is also a commonly used type of loop expression and it's often used with just two keyframes, although you can use pingpong with any number of keyframes.

Use Case

As the girl is biking, her body, head, and earrings all rotate back and forth using the pingpong loop expression.

Continue

The continue loop type continues the animation at the same speed as your last keyframe (for loopOut, or first keyframe for loopIn).

Keep in mind that if the speed reaches zero as it reaches the keyframe, this expression won't do anything. It's easiest to adjust this in the graph editor.

Use Case

In this example the some of the blue circles (fluid) and green circles (waste) move from inside a capillary, out through a gap, and into a fluid space. I keyframed this animation, but once they reach the fluid space, I just wanted them to continue to drift, so I used the loopOut("continue") expression.

Offset

The offset loop type creates a stair stepping effect. It repeats the animation on the keyframes but by building off of the animation that's already occurred.

Use Case

In this example, I animated a precomp of the jellyfish swimming by using the loopOut("offset") expression on the position property. The jellyfish moves fast and slow corresponding to the way it contracts it's body because of the easing on the keyframes. The precomp that contains all the animation on the jellyfish itself is also looping with loopOut("cycle"). Learn how to loop a composition in this tutorial.

Modifier

If you only want to repeat some of the keyframes, you can use a modifier. This number is optional. If you don't enter a modifier, it's like having a modifier of 0, which means that all keyframes will be repeated.

Think of it as the modifier number as the number of keyframes that you ONLY want to repeat.

Here are some examples:

loopOut("cycle",3): This will repeat the last keyframe and the 3 before it.

loopIn("pingpong",1): This will repeat the first keyframe and the 1 after it until it reaches the first keyframe.

loopOut("offset",1): This will apply the offset loop to the last keyframe and the 1 before that.

You also might like:

11 Expressions for Animation Efficiency

11 Expressions for Animation Efficiency

in Adobe After Effects

Learn 11 different expressions to automate animations, eliminate excessive keyframes, achieve complex effects, and work more efficiently; no programming experience needed!

Check out the class
Looping Animated Scenes

Looping Animated Scenes

in Adobe After Effects

Learn how to create seamlessly looping animations for websites, social media, or as part of longer, narrated animations.

Check out the class
© 2024 Explanimated, LLC