Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Distribute multiple layers between two End layers?

  • Distribute multiple layers between two End layers?

    Posted by Ocean Byrne on June 7, 2020 at 6:23 am

    Is there a quicker way to setup, or some help writing an expression, to distribute multiple layers between two End layers?

    • Ideally, it would work for 2d or 3d layers, and distribute pos / rot / scale / opacity.
    • It would be awesome if it automatically adjusted if you added or subtracted interim layers. Short of that, maybe the expression could start with variables like Order = 5 of Total = 15
    • It would be super cool if you could some how adjust “ease” on one End or the other, but just linear distribution between the two would be fine.
    • Finally it would be cool if it was easy to paste on to other channels like one’s in Effects or whatever one might want to interpolate from layer to layer….

    I understand the theory pretty well, but my syntax is crap. Help would be appreciated…

    Humble Pixel Farmer

    Ocean Byrne replied 5 years, 3 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    June 8, 2020 at 12:57 am

    I think this will distribute a property between two layers named “Start Layer” and “End Layer” (change the first two lines if your bookend layers have different names):


    startLayerName = "Start Layer";
    endLayerName = "End Layer";
    sStr = 'thisComp.layer("' + startLayerName + '")';
    eStr = 'thisComp.layer("' + endLayerName + '")';
    sIdx = eval(sStr + '.index');
    eIdx = eval(eStr + '.index');
    p = thisProperty;
    str = ".value";
    while(!(p instanceof Layer)){
    str = '("' + p.name + '")' + str;
    p = p.propertyGroup(1);
    }
    sVal = eval(sStr + str);
    eVal = eval(eStr + str);
    linear(index,sIdx,eIdx,sVal,eVal)

    It assumes that the layers are contiguous in the layer stack, with “Start Layer” at the top and “End Layer” at the bottom.

    Dan

  • Ocean Byrne

    June 8, 2020 at 1:20 am

    What, no ease on the end layers? I kid. This is super AWESOME! Thanks so much Dan!

    _________
    Ocean Byrne
    Humble Pixel Farmer

  • Ocean Byrne

    June 22, 2020 at 10:40 am

    Is there a way to set a time offset on the start and end layer to be able to use this expression?

    I can adjust each layer manually to start 1 frame later than the previous, but it would be great to be able to adjust a slider on the End Layer and have them all interpolate between…

    Thanks again!

    _________
    Ocean Byrne
    Humble Pixel Farmer

  • Ocean Byrne

    February 3, 2021 at 10:02 pm

    Could have sworn I had figured this out, but not finding anything but this. How can I apply this same theory/expression to a channel within layers? Specifically I am wanting to blend between 2 animating shape lines. (they could be masks with strokes on them instead if that would work better.)

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