FORUMS: list search recent posts

Layers in a grid need to change the spacing between them

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
riccardo sinti
Layers in a grid need to change the spacing between them
on Oct 12, 2012 at 6:11:34 pm

I have many layers laid out in a grid using a script. IS there an expression I can add to them, linked to a slider, so that I can change the distance between all the layers?
thanks


Return to posts index

Dan Ebberts
Re: Layers in a grid need to change the spacing between them
on Oct 12, 2012 at 6:36:18 pm

The expression would need to know where its layer is in the grid. I think I would let the expression control the grid spacing. You'd have a null named "controls" on the bottom of the layer stack with a Point Control named "Origin" to control the position of the upper-left element of the grid, a slider named "Horiz Spacing" to control the horizontal spacing, one named "Vert Spacing" for vertical spacing, and another named "Number of Columns" to control the number of columns. Then each layer participating in the grid (starting with layer 1) would have this expression:

L = thisComp.layer("controls");
origin = thisComp.layer("controls").effect("Origin")("Point");
hSpace = thisComp.layer("controls").effect("Horiz Spacing")("Slider");
vSpace = thisComp.layer("controls").effect("Vert Spacing")("Slider");
nCols = thisComp.layer("controls").effect("Number of Columns")("Slider");

n = Math.round(nCols);
col = (index-1)%n;
row = Math.floor((index-1)/n);
origin + [col*hSpace,row*vSpace]


Dan



Return to posts index

Dan Ebberts
Re: Layers in a grid need to change the spacing between them
on Oct 12, 2012 at 6:57:37 pm

Oops. That last line should be:

L.toComp(origin) + [col*hSpace,row*vSpace]


Dan



Return to posts index

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