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.
0:43 - Loop Property
1:34 - Loop Type
7:10 - Loop Modifier
The first part of the loop expression is the property. There are two options:
Repeats the keyframes after the last keyframe.
Repeats the keyframes before the first keyframe.
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.
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().
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.
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.
As the girl is biking, her body, head, and earrings all rotate back and forth using the pingpong loop expression.
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.
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.
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.
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.
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.
Learn 11 different expressions to automate animations, eliminate excessive keyframes, achieve complex effects, and work more efficiently; no programming experience needed!
Learn how to create seamlessly looping animations for websites, social media, or as part of longer, narrated animations.