Highlighted

Anyone got an expression for looping path keyframes?

New Here ,
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

Most Valuable Participant
Correct answer by Roei Tzoref | Most Valuable Participant

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

TOPICS
Expressions

Views

20.2K

Likes

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

Anyone got an expression for looping path keyframes?

New Here ,
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

Most Valuable Participant
Correct answer by Roei Tzoref | Most Valuable Participant

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

TOPICS
Expressions

Views

20.2K

Likes

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
Jan 17, 2017 4
Most Valuable Participant ,
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)

Likes

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
Reply
Loading...
Jan 17, 2017 5
New Here ,
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!

Likes

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
Reply
Loading...
Jan 17, 2017 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
Jan 17, 2017 4
New Here ,
Nov 24, 2019

Copy link to clipboard

Copied

Nice! It still works in AE 2020! Thanks! 

Likes

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
Reply
Loading...
Nov 24, 2019 0
New Here ,
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 !

Likes

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
Reply
Loading...
Jul 29, 2020 0