ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

get previous layer position value and offset

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrea Marini
get previous layer position value and offset
on Sep 22, 2012 at 3:10:30 pm

I need to offset each layer 500 px on the X axis from the previous layer. Is it possible to do something like (example) previouslayerinstackXvalue + 500 ?
I'd like to do that so when I duplicate a layer it automatically offsets 500px away from previous layer.

Thanks


Return to posts index


John Cuevas
Re: get previous layer position value and offset
on Sep 22, 2012 at 5:11:20 pm

You could do it like this. Create a null and that will be your inital position. Add the layer you want to offset above the null layer in the layer stack and this expression:

var offset = 500;
x= thisComp.layer(index+1).transform.position[0]+offset;
y= transform.position[1];
[x,y]


Now every time you duplicate that layer it will move 500 px to the right of the previous layer. Here's an example project to check out: 4688_positionexpression.aep.zip

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.


Return to posts index

Andrea Marini
Re: get previous layer position value and offset
on Oct 6, 2012 at 7:41:48 am

John, that is exactly what I was looking to. Thanks for your help!


Return to posts index

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