After Effects is one of the most popular and efficient tools used for creating motion graphics, animations and VFX. It is an Adobe software available in both windows and apple systems. It is also a great tool to create looping animations. This process is achieved with the use of Expressions, which is a type of coding used in After Effects.

Using Expressions for Looping Animations

Whenever you create motion graphics or other animated graphics in After Effects, looping compositions and animation become very handy through Expressions. Although Expressions might not be necessary every time you want to animate, it is an effective technique for better workflow if applied.

It is especially helpful for longer length animations, background animations, infomercials, and visual prototypes. It helps you avoid the repetitive layer overwriting, overriding and positioning over the timeline when working on looping frames or multiple pre-compositions.

There are other ways of looping animations in after effects, but the ones I found most effective and productive for my day-to-day life are as follows:

Looping Motion Expression

We can use expression controls in After Effects to loop animations and compositions. Let's try to create this previewed animation loop in After Effects.

Animation Loop Example
  1. First, create the animation with a proper timeline and keyframe.
  2. Now, select the keyframes you want to loop.
  3. Press Alt (option on macOS) and click Expression.
  4. Select the property Lookout Duration.
  5. Now simply drag the layer across the timeline to loop the animation.
💡
You can also manually enter the code loopOut(type = "cycle", numKeyframes = 0) in the expression text editor in the timeline to achieve the same effect.

Looping Composition Expression (Flicker-free)

After Effects shows weird behaviour when it comes to looping compositions. Using the same technique from the steps above skips the last frame when previewing the animation. This means that it shows a blank empty frame at the end of the loop when playing, creating a flickering effect and ruining the loop.

Flickering Loop in After Effects

I'm not sure if it's a bug or something else. I looked up solutions on the internet and found a workaround.

The solution itself is kind of weird. Here are the steps that should be followed to perform a bulges composition loop.

  1. Select the animated composition you want to loop in your timeline.
  2. Right-click the composition and navigate to Time > Enable Time Remapping. After doing this, After Effects automatically adds two keyframes at the beginning and end of the composition, stretching the composition length across the timeline.
  3. Now, navigate to the last keyframe and add a new keyframe just before the last keyframe.
  4. Double the last keyframe. This brings up the time remap value editor.
  5. Change the value to 0, close it, and delete the keyframe. It's weird, but this is how it works.
  6. With the remaining keyframes selected, press Alt (option on mac) and click the Time Remap Stopwatch.
  7. Add the loop-out cycle expression by clicking the arrow button to create the loop. The Loopout cycle expression can be found under the property menu.
  8. Now drag the composition to the desired timeline and see it loop without flickering.
💡
Or you can manually enter the code loopOut(type = "cycle", numKeyframes = 0) in the expression text editor in the timeline to achieve a similar effect in Steps 6 to 9.

You can also watch this video tutorial if you don't understand the steps in the text.

Hope this solved your looping flickering problem too!