• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
10

Anyone got an expression for looping path keyframes?

New Here ,
Jan 17, 2017 Jan 17, 2017

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

TOPICS
Expressions

Views

62.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 17, 2017 Jan 17, 2017

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

Votes

Translate

Translate
LEGEND ,
Jan 17, 2017 Jan 17, 2017

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2017 Jan 17, 2017

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2017 Jan 17, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 24, 2019 Nov 24, 2019

Copy link to clipboard

Copied

Nice! It still works in AE 2020! Thanks! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

Works in After Effects 2021. Hero and lifesafer!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

Thanks, you are a legend !

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 29, 2020 Jul 29, 2020

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 !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

Hey @Roei Tzoref ! 

 

Your suggestion is great, but do you have a solution for a "pingpong" loop? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2020 Dec 03, 2020

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. 

  • Select the first keyframe and copy
  • Move the CTI past the second keyframe the same distance as it is from the first keyframe and paste.

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:

  • Select all keyframes except the last keyframe and copy
  • Move the CTI past the last keyframe the same number of frames as the distance between the last two keyframes and paste
  • Make sure the keyframes you just pasted are the only ones selected and select Animation/Keyframe Assistant/Time Reverse 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.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 16, 2021 Jan 16, 2021

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines