This is actually quite simple. Just multiply the offset value in pixels by the index and add it to the current position of y.
The expression looks like this:
x = value; y = value; offset = 20; // offset in pixels newy = y + (index * offset); [x, newy]
- First you get the current value for X and Y
- Then you set a value for the offset. In this case 20 pixels
- Then you get the new y position by adding the current Y value to the index times the offset
- Finally you put these values in an array enclosed in brackets. If you are working in 3D space you'll also need to define and place in the array a value for Z
If you wanted to animate the space between layers I'd add a null to the bottom of the stack, add an expression control slider to the null, and then change the third line of the expression to:
offset = thisComp.layer("Null 1").effect("Slider Control")("Slider"); // offset in pixelsThen apply this expression to any of the text layers (or any other kind of layer) and select position and go to Edit>Copy Expression only. Then select all other layers you want to offset and paste. Badda bing – you're done.
It does help, thank you very much!
Damn, I just had the chance to test this and the expression (though helpfull) doesn't do what I'd need :S
I think I didn't explain myself well enough! What I'm looking for is an expression that would sread the layers evenly to the comp according to how many layers there are in total. So if there was just two layers, I would like them to be spread out so that there is equal amount of space between the top and bottom of the comp and those two layers. In other words the layers would always be centered and evenly spread on the y-axis of the comp, no matter how many layers there were! Maybe it gets harder..?
Any additional help will be appreciated greatly!
1 person found this helpful
cHeight=thisComp.height; cNum=thisComp.numLayers; cSpread=cHeight/cNum; X=value; Y=index*cSpread-cSpread*0.5; [X,Y]
Thanks Mylenium, you're the Man!