How to loop in After Effects

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.

So, what are you trying to loop in After Effects?

I want to loop an animated property like position/rotation/scale.

I want to loop an entire composition.

I want to loop video footage I've imported into After Effects.

How to loop keyframes in After Effects

This is perhaps the most simple way to loop something 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:

Extend composition after effects

This will bring up the expression box, you then need to type the following expression (watch out for the capital O):

loopOut("cycle");

Now, with this 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 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 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!

How to loop an After Effects composition

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:

Extend composition after effects

How to loop video footage in After Effects.

Looping video footage can be done in multiple ways within After Effects, you can just use the method for looping compositions in After Effects that's mentioned above however there is a much simpler option like so:

Step 1. Import your footage into After Effects

Double click the project panel and find the video file you want to import.

Step 2. Click Interpret footage

With your footage selected in the Project panel, click the "Interpret footage" icon in the bottom left hand corner:

interpret footage after effects project panel

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!

loop options footage after effects

Enjoyed this post? Share it with your friends: