Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Second Thing…

  • Posted by Luke Hale on April 10, 2007 at 8:00 pm

    I want to position many duplicates of a precomp in a grid pattern. I can position them in the x and y indepently using the expression;

    x = thisLayer.width*index;
    [x,thisLayer.height]

    Not sure how to fill in the rest of the grid. Also ideally i would like every other column to be offset (0.5 * thisLayer.height) down in the y direction, so that the square layers look kind of like a rotated brick wall. Would it be possible to combine all in one expression?

    Thank you very much in advance

    Luke

    Luke Hale replied 19 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 10, 2007 at 8:34 pm

    Something like this should work:

    numCol = 12; // number of layers in one row
    origin = [width,height]/2; // center of upper left layer

    row = Math.floor((index-1)/numCol);
    col = (index-1)%numCol;
    x = col*width + width/2;
    y = row*height + height/2;
    if (col%2) y += width/2;
    [x,y]

    Dan

  • Luke Hale

    April 10, 2007 at 9:02 pm

    Thanks again Dan, I really appreciate your help.

    Luke

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy