Skip to main content
SaltyAndSweet
Participant
January 7, 2022
Answered

Is there a better way to quickly apply a loop(cycle) expression?

  • January 7, 2022
  • 4 replies
  • 480 views

I often use the loopOut("cycle") expression to loop footage that is Time Remapped in After Effects.
The problem is that it doesn't create a seamless loop. Everytime I have to go into the keyframes for the Time Remap. Set a key for the frame before the last key and then change the last key to match the first key frame.
Only then does the loopOut("cycle") expression create the correct loop.
Is there a better expression that will give me a seamless loop without having to alter the keyframes?
Or is there a simpler way to achieve this?

This topic has been closed for replies.
Correct answer Dan Ebberts

Try this:

f1 = timeToFrames(key(1).time);
f2 = timeToFrames(key(2).time);
fCur = timeToFrames(time);
period = f2-f1;
framesToTime(fCur%period)

4 replies

ShiveringCactus
Community Expert
Community Expert
January 8, 2022

I'm not near my computer at the moment, but I really want to try Dan Ebbert's expression to see what it does.  I looked at this a while ago in a different way.  Essentially creating a precomp which faded from one loop into the next:

https://youtu.be/fXT8uUIkuP8 

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
January 7, 2022

Try this:

f1 = timeToFrames(key(1).time);
f2 = timeToFrames(key(2).time);
fCur = timeToFrames(time);
period = f2-f1;
framesToTime(fCur%period)
SaltyAndSweet
Participant
January 10, 2022

This is exactly what I was after.
I will add this to my library of expressions.
Thanks Dan, you are a legend, I've learned so much from you over the years.

Thank you for all your contributions to the community.

gupta shivangi
Legend
January 7, 2022

Hi there,

 

Thanks for writing in. Did you try the suggestion given by the expert above? We can consult our engineering team if you need further help.

 

Let us know. 🙂

 

Regards,

Shivangi

Mylenium
Legend
January 7, 2022

You could just render and re-import the footage, then set the repeats in the footage interpretation. Otherwise that's just how this stuff works, even if it's admittedly sometimes rather annoying.

 

Mylenium