As with most things in After Effects, there are numerous ways to go about creating a loop and this will largely depend on what it is you’re trying to loop.
With that in mind, here’s a couple of options to choose from that will tell you how to loop in After Effects:
- How to loop position/rotation/scale property in After Effects using the loop expression.
- How to loop an After Effects composition using the loop expression.
- How to loop a video in After Effects.
How to loop keyframes in After Effects using the loop expression
This is perhaps the most simple way to loop in After Effects.
Let’s say you have two keyframes on the position property of a shape layer that moves the layer from top to bottom.
If you want this animation to loop all you have to do is alt-click the stopwatch next to the position property:
This will bring up the expression box, you then need to type the following loop expression after effects nicely provides for us (watch out for the capital O):
loopOut("cycle");
Now, with this loop expression applied, when the time marker reaches your last keyframe and moves past it, the keyframe animation will loop endlessly until the end of your composition.
The handy thing about the loopOut expression is that it also has some other options you can use too.
The cycle example above restarts your animation from the first keyframe, it cycles through all the keyframes in the order you’ve placed them.
Let’s say however, that when your animation reaches the end keyframe, you want it to reverse back through the animation to the first keyframe and then start again.
Well, in this case, instead of writing “cycle” inside the loopOut expression you can use the aptly named pingpong option like so:
loopOut("pingpong");
Imagine a game of ping pong being played, the ball goes back and forth between the two players. This is exactly what happens to your animation keyframes, after effects loops the animation back and forth between the start keyframe and the last keyframe.
The great thing about this loop expression is that you can use it on pretty much every keyframed property, not just the position. So if you want After Effects to loop through a scale animation on a layer, just apply the same loop expression to your scale keyframes.
There are a couple of other options for the loopOut expression which we won’t get into here but have an experiment with them!
That’s how to loop keyframes in after effects, now let’s look at how to loop a composition in After Effects:
How to loop an After Effects composition using the loop expression
Looping precomps or compositions in After Effects can also be done using the loopOut expression mentioned above. It does however require a couple more steps like so:
First, you need to have your composition inside another composition (if you’ve precomped layers in your composition then this will already be done for you.)
The next step is to enable time remapping, to do this select your composition layer, right click the layer and choose Time > Enable Time Remapping.
This will bring up a new property on your layer called Time Remap along with two keyframes: one at the start of your composition and one at the end.
Important: your composition may be longer than the animation you want to loop, if this is the case you need to do the following:
- Move the time marker to the point at which you want the animation to loop
- Click the keyframe button on the Time Remap property to create a new keyframe
- DELETE the last keyframe on the Time Remap property
The next step is to alt-click the stopwatch on the Time Remap property and add the loopOut expression, again depending on the type of loop you want to happen you can use either:
loopOut("cycle") - to restart your loop from the first keyframe
Alternatively, use:
loopOut("pingpong") - to reverse through the animation back to the first keyframe
This will then loop your composition animation.
Common problems when looping compositions:
There's a single black frame at the end of the loop.
When this happens all you have to do is move the time marker to the last keyframe of your composition, move one frame back and create a new keyframe, then delete the old last keyframe.
My animation disappears after one loop
If this happens, chances are you need to extend the layer. To do this move your mouse to the outpoint of your composition layer then click and drag it along the timeline like so:
Now we’ve seen how to loop keyframes and how to loop compositions in After Effects. Next, we’ll look at how to loop video in After Effects:
How to loop video in After Effects.
Looping video in after effects can be done in multiple ways, you can just use the loop expression method for looping compositions in After Effects that’s mentioned above however there is a much much simpler option.
Here’s how to loop video footage in After Effects the easy way without using any loop expressions:
Step 1. Import your video into After Effects
Double click the project panel and find the video file you want to import into After Effects.
Step 2. Click Interpret footage
With your footage selected in the Project panel, click the “Interpret footage” icon in the bottom left hand corner:
Step 3. Set the loop count
At the very bottom of the interpret footage pop-up there’s an Other Options panel, you’ll notice there’s an option for Loop.
Change the number from 1 to any number you want to loop by, 20 or 100, you can always change this later if you find the looped footage isn’t long enough!
And there we have it! That’s three different ways you can loop things in After Effects.