Copy link to clipboard
Copied
Paths seem to be the only things you can't apply a loop expression to. Is there any other expression that will do the same trick?
I know you can precomp the layer and loop a time remap.
Or you could loop a slider which plays through the animation.
But i'm just looking for an expression to apply to the layer in question, exactly the way we apply loopOut expressions.
Thanks
Ross
if (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
}else
value
courtesy of the Master Expressionist Dan Ebberts in this thread: loopOut pingpong doesn't work on a mask shape? : Adobe After Effects Expressions
Copy link to clipboard
Copied
when it comes to path property, I found that valueAtTime is what you usually use for an expression.
I also found this while digging around for the same question:
valueAtTime(time % key(numKeys).time)
Copy link to clipboard
Copied
That is very helpful. Thanks.
It works if the keyframes begin at the beginning of the composition's time.
Is there a way of making the loop begin from when the first keyframe is?
thanks man!
Copy link to clipboard
Copied
if (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
}else
value
courtesy of the Master Expressionist Dan Ebberts in this thread: loopOut pingpong doesn't work on a mask shape? : Adobe After Effects Expressions
Copy link to clipboard
Copied
Nice! It still works in AE 2020! Thanks!
Copy link to clipboard
Copied
Works in After Effects 2021. Hero and lifesafer!
Copy link to clipboard
Copied
Thanks, you are a legend !
Copy link to clipboard
Copied
thank you for your answer, I had the same issue when trying to loop a path in AE. Now it all works out nice and perfect !
Copy link to clipboard
Copied
Copy link to clipboard
Copied
To make the expression loop a path animation you'll have to create the ping pong by copying and pasting keyframes, then selecting keyframes and using the Keyframe Assistant to Time Reverse the keyframes if there are more than 2 keyframes.
Here's the workflow for 2 keyframes.
If your first keyframe is at frame zero and the second keyframe is at frame 20, then move the Current Time Indicator to frame 40 and paste.
Here's the workflow for 3 or more keyframes:
If the next to the last keyframe is at frame 60 and the last keyframe is at frame 70 the difference is 10 frames so move to frame 80 and paste, then time reverse and you have your pingpong.
Copy link to clipboard
Copied
This was very helpful to me ... I'm so glad I found the answer to my problem on an existing support community post rather than having to create a new one. This worked perfectly for looping path animations and even a null object that was being used to animate other visible objects in a hierarchy.
Thanks again!