Skip to main content
Inspiring
January 28, 2022
Answered

Auto-transforming layer duplicates

  • January 28, 2022
  • 1 reply
  • 299 views

Hey guys!

 

I need to tile a layer.

For the effect I'm going for, I can't use repetile.

Duplicating by hand is too painful.

I've found this expression:

x = (index-1)*50;
[x,transform.position[1]];

 It works for duplicating my layers (each one is 50x50px, so, perfect).

However, this only gets me a row of layers, right.

I'm sure there's a way to do this for the Y axis.

I've tried manually doing one column and then duplicating the layers, but that doesn't work because it shifts each layer 50px more on the X axis each time I duplicate...

This topic has been closed for replies.
Correct answer Mylenium

You divide the index with the modulus:

 

(index-1) % numCols

 

This will return the index inside row and then you just need to multiply it with incremental indices per row. This is used in this old tutorial of Dan Ebberts:

 

http://www.motionscript.com/expressions-lab-ae65/random-grid-movement.html

 

You can easily find other examples for grids and tables using this technique in a simple web search.

 

Mylenium

1 reply

Mylenium
MyleniumCorrect answer
Legend
January 28, 2022

You divide the index with the modulus:

 

(index-1) % numCols

 

This will return the index inside row and then you just need to multiply it with incremental indices per row. This is used in this old tutorial of Dan Ebberts:

 

http://www.motionscript.com/expressions-lab-ae65/random-grid-movement.html

 

You can easily find other examples for grids and tables using this technique in a simple web search.

 

Mylenium

G5CD7Author
Inspiring
January 28, 2022

Thank you!