Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects LoopOut to comp length

  • LoopOut to comp length

    Posted by Trevor Morgan on August 18, 2021 at 6:00 pm

    Greetings folks.

    is there a way to use the loop expression to perfectly match the comp length without messing with keyframes?

    For example I have a glow effect, the intensity (up and down) needs to loop the comp length… I could make the keyframes specific to the comp time, but that gets tedious when I have to change the comp length for different deliverables…

    Right now I’m using:

    loopOut(“cycle”)

    Then setting keyframes manually to fit comp length so it makes a perfect loop.

    Is there an easier way to set the expression up? any help much appreciated!

    Thanks!

    Trevor Morgan replied 4 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    August 18, 2021 at 7:00 pm

    This expression, applied to the property with the keyframes that you want to loop, should do the trick. It will calculate the nearest number of complete cycles that will fit in the comp time based on your keyframe timing, then loop it like cycle from the start of the comp to the end.

    Note that you will lose direct control of timing; it will stay as close as possible to your setup in order to loop seamlessly.

    if (numKeys > 1) {

    var keyDuration = key(numKeys).time - key(1).time;

    var compDuration = thisComp.duration;

    var numCycles = Math.round(compDuration / keyDuration);

    var cycleDuration = compDuration / numCycles;

    var cycleTime = linear(time % cycleDuration, 0, cycleDuration, key(1).time, key(numKeys).time);

    valueAtTime(cycleTime);

    }

    else value;

  • Trevor Morgan

    August 19, 2021 at 3:59 am

    Stoked! Works great.

    THanks!

    -tm

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