Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Incremental Animation based on Layers or Markers

  • Incremental Animation based on Layers or Markers

    Posted by Griffin Englander on June 20, 2024 at 1:34 am

    Hello friends,

    I’m wondering if there’s a way to incrementally repeat/offset a set of keyframe’s animation, similar to how loopOut(“offset”) works, but to only trigger at every marker? Or in an ideal world, though may be a stretch, to trigger at the inPoint of any layer with a defined prefix.

    eg. ‘Shape Layer 1’ has two position keyframes moving it up 20px. I’d like for it to automatically move up an extra 20px (with the same ease) every time either there’s a marker, or if possible, at the inPoint of layers L_01, L_02 etc

    Hope this makes sense,

    Thanks in advance!

    Brie Clayton replied 1 year, 11 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    June 20, 2024 at 6:51 am

    I think this will work for your layer in point scenario:

    n = 0;
    trig = 0;
    for (i = 1; i <= thisComp.numLayers; i++){
    if (i == index) continue;
    if (thisComp.layer(i).name.indexOf("L_") == 0){
    if (time > thisComp.layer(i).inPoint){
    n++;
    trig = Math.max(trig,thisComp.layer(i).inPoint);
    }
    }
    }
    if (n > 0){
    d = key(numKeys).value - key(1).value;
    key(numKeys).value + (n-1)*d + valueAtTime(key(1).time + (time - trig)) - key(1).value
    }else{
    value;
    }
  • Griffin Englander

    June 21, 2024 at 12:03 am

    You’re sick, Dan. That works, thank you!!

    Is there a way to have the original keyframes have no affect, until the first ‘L_’ in point? Almost like that triggers the first increment of animation?

    No worries if not, this works better than I imagined it would.

    Thanks,

  • Dan Ebberts

    June 21, 2024 at 3:31 am

    I think that would be like this:

    n = 0;
    trig = 0;
    for (i = 1; i <= thisComp.numLayers; i++){
    if (i == index) continue;
    if (thisComp.layer(i).name.indexOf("L_") == 0){
    if (time > thisComp.layer(i).inPoint){
    n++;
    trig = Math.max(trig,thisComp.layer(i).inPoint);
    }
    }
    }
    if (n > 0){
    d = key(numKeys).value - key(1).value;
    key(numKeys).value + (n-2)*d + valueAtTime(key(1).time + (time - trig)) - key(1).value
    }else{
    key(1).value;
    }
  • Griffin Englander

    June 21, 2024 at 3:38 am

    That’s done it. Thanks Dan!

  • Brie Clayton

    June 21, 2024 at 9:53 pm

    Thanks for solving this Dan!

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