Skip to content
Back

Loop the Path with Expressions

March 16, 2021
Max Kravchenko

Max Kravchenko

Motion Designer & Tutor

The loopOut expressions is used so many times in our workflow.
Unfortunately, it’s not working for a path. But we have the solution for you. Just use this expression, and it will be working even with the path:

timeStart = thisProperty.key(1).time; 
 duration = thisProperty.key(thisProperty.numKeys).time-timeStart; 
 pingPong = true; 
 quant=Math.floor((time-timeStart)/duration); 
 if(quant<0) quant = 0 //no negative numbers
 if(quant%2 == 1 && pingPong == true){ 
 t = 2timeStart+ (quant+1)duration - time; }
 else{ 
 t = time-quant*duration; }
 }
 thisProperty.valueAtTime(t)

Congratulations on the new achievement. Now you can loop the path with expressions! Woohoo!

How to loop path with expression in After Effects

In Adobe After Effects, you can create looped animations using expressions. A loop expression allows you to repeat a specific animation or movement indefinitely. Here’s an example of a loop expression in After Effects:

  1. Create a new composition by going to “Composition” > “New Composition” or using the shortcut Ctrl+N (Windows) or Command+N (Mac).
  2. Create a new solid layer by going to “Layer” > “New” > “Solid” or using the shortcut Ctrl+Y (Windows) or Command+Y (Mac).
  3. Select the solid layer and press the letter ‘P’ on your keyboard to reveal its position property.
  4. Alt-click (Windows) or Option-click (Mac) on the stopwatch icon next to the Position property. This will open the expression editor.
  5. Enter the following expression:

    loopOut(“cycle”);
  6. Close the expression editor.

Now, the solid layer will continuously loop its position animation. If you move the layer in the timeline After Effects will automatically generate keyframes to create a seamless loop.

You can customize the loop expression to fit different types of animations or properties. Here are a few variations:

These are just a few examples of what you can do with loop expressions in After Effects. Experiment with different expressions and parameters to achieve the desired looping effect for your animations.

What is the Motion Beast course?

This is the must-see course for any Motion Designer. It lays the foundation for all aspects of modern motion design and covers every topic from AE basics to character rigging and frame-by-frame animation.

The course will help you overcome AE-related barriers and fears which are standing between you and the wonderful world of animation and motion design

ONLINE COURSE

Motion Beast

    Your cart is empty

    Your cart is empty. Let's fix it!

      AccountAccount icon

      @