With this expression, you can automate the arranging the object on a rectangular position by duplicating the layer like the image below.
[Quick Set Up]
Create the first object and position it wherever you want. As a leader object, it’s a base of all positions. The name of first object needs to include a space and number 1, such as “rectangle 1”. Then duplicate it and apply the expression below to the position property.
objNum = 5; //number of objects in a line pos = thisComp.layer("rectangle 1").transform.position; //leader's position num = parseInt(name.split(" ")) - 1; repeatX = num % objNum; repeatY = Math.floor(num / objNum); gapX = 200; //pixel gapY = 200; //pixel x = gapX * repeatX; y = gapY * repeatY; pos + [x, y]
Here’s a sample with a modified version of this expression.
After all, a project file is worth a thousand words. So download it from the link below and play around with it!
I would much appreciate it if you could give me a feedback. So please don’t hesitate to get in touch with me if you find some errors or better ways.
I hope you develop the expression and create awesome motion graphics.