Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Loop a specific 'time' instead of keyframes

  • Loop a specific 'time' instead of keyframes

  • Stephan Zammit

    October 25, 2021 at 2:52 pm


    I am working on a project where I have an expression that gives a time output, where the keyframes have been re-timed dependent on the time on the keyframes, etc.

    So the end of the expression basically looks like this:


    I would like to have this value to loop after it runs the first cycle. Of course the loopOut only works with keyframes, so was wondering if there is some other way.

    Is this possible?


  • Matteo Cozzo

    October 25, 2021 at 4:05 pm


    if I understand what you’re trying to do, you actually can loopOut time by pre-composing, then enabling time remapping and setting two keyframes corresponding to the start and ending points of your animation.

    Once you have those you can use an expression to loop the whole thing.

    You might need to set the second keyframe one frame before the actual end of the comp to ensure it loops out nice and even, ’cause sometimes it flutters on the final frame if you don’t.

    Hope this helps!


    for the last part, I mean set the end keyframe, then copy it and past it one frame before. Then delete the other.

  • Dan Ebberts

    October 25, 2021 at 8:25 pm

    Hard to say exactly without seeing the details, but if you know the loop duration, you can do something like this to make it loop:


  • Stephan Zammit

    October 26, 2021 at 8:10 am

    Hi Dan,

    Thank you so much for your reply! This works almost as needed. The only problem is that it seems to only loop correctly when the layer starts from time 0, when moving the layer in time the loop gets offset, since the original keyframes are being moved with it.

    I tried doing the following:


    This works correctly for the first loop but then of course has a pause of that key(1).time, until the next loop happens again. I cannot seem to figure out how to cancel this ‘pause’so that the loop starts right after ignoring the key(1).time.

  • Dan Ebberts

    October 26, 2021 at 10:59 am

    I’m sure the math is pretty straightforward, it’s just hard to picture exactly how you have it set up. Maybe you could post a screenshot that shows the keyframes and the section you want to loop.

  • Stephan Zammit

    October 26, 2021 at 11:06 am

    Hi Dan,

    thank you for getting back to me! Just manage to get the hang of it after a lot of fiddling.

    I was actually doing it like this:

    finalTime = (t+key(1).time)%loopDuration

    so the time of the first keyframe was messing up the loop. Solved it with the following:

    finalTime = (t%loopDuration)+key(1).time

    Thank you so much for your input, much appreciated! 🙂

Viewing 1 - 6 of 6 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy