ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Distribute multiple layers between two End layers?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ocean Byrne
Distribute multiple layers between two End layers?
on Jun 7, 2020 at 6:23:18 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


Return to posts index

Dan Ebberts
Re: Distribute multiple layers between two End layers?
on Jun 8, 2020 at 12:57:31 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



Return to posts index

Ocean Byrne
Re: Distribute multiple layers between two End layers?
on Jun 8, 2020 at 1:20:05 am

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


_________
Ocean Byrne
Humble Pixel Farmer


Return to posts index


Ocean Byrne
Re: Distribute multiple layers between two End layers?
on Jun 22, 2020 at 10:40:51 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]