ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Change layer order with expressions

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
MattMariska
Change layer order with expressions
on Feb 15, 2007 at 4:07:37 am

Hello! I'm new to posting to these forums, but I've been reading them for help countless times over the past years.

I'm just a beginner with AE Expressions, and I was wondering if the following is possible:

I would like to change the order (or perceived order) of layers in my composition, based on their Y axis. In this composition, the lower a layer is vertically, the closer it should be to the camera. Therefore, anything lower vertically should overlap anything else higher vertically. Is this possible?

I hope I'm explaining myself well enough. Thank you for taking the time to give me a hand with this.

-Matt


Return to posts index

Colin Braley
Re: Change layer order with expressions
on Feb 15, 2007 at 7:24:26 am

Well you can't make the layers become stacked in a different order via expressions, however scripting could sort the layers based on the y position at frame zero, or something like that. However, you could change the z-position of layers based on y position. You could create an expression to do something like place the layer with the largest y value at z = 0, the layer with the second largest y value at z = -100, the layer with the third largest y value at z = -200 etc. Just clarify what you are looking for a bit more and Im sure someone will be able to help you out.
~Colin


Return to posts index

Dan Ebberts
Re: Change layer order with expressions
on Feb 15, 2007 at 2:30:18 pm

Yeah, I'd make them all 3D and use an expression like this to sort them in Z space:

below = 0;
for (i = 1; i <= thisComp.numLayers; i++){
if (i == index) continue;
if (thisComp.layer(i).position[1] < value[1]) below--;
}
[value[0],value[1],below]


Dan



Return to posts index


MattMariska
Re: Change layer order with expressions
on Feb 15, 2007 at 6:37:03 pm

Thanks! I'll give this a try, and see if it works out.

Thanks for taking the time to look this over.


Return to posts index

Mark Mitchell
Re: Change layer order with expressions
on Feb 22, 2019 at 2:31:51 pm

Hi Dan I have 8 layers where I need to have only one layer at a time above all the others - like the apple dock. I am not familiar with expressions and hope you can explain which parameters I need to change to hopefully have this expression work for me.

Thanks.
Mark

Regards

Mark


Return to posts index

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