This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Kasper Andersen
Posted Jul 29 - Read on Facebook

Hey there.

I'm creating a grid using the snippet from Framer, a 3x3 grid. Now I want to have an image, in each of the layers in the grid, from an array.

If it was a list i would do image:array[rowIndex] and get different pictures, but what do I do when i have both a "rowIndex" and a "colIndex"?
I tried to do [rowIndex*colIndex] but that doesn't give me the right order of pictures.

4 Comments

Jonas Treub
Jonas Treub

With: "loop-index % (amount of columns)", you can calculate the column Index per item.

Jonas Treub

"Math.floor(loop-index / (amount of columns))", gives you the row index per item

Josh Ackerman

You could also make a 2D list (matrix) like [[0,0,0],[0,0,0],[0,0,0]] but with images instead of zeros and set image to something like matrix[i][j].

Read the entire post on Facebook