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

What is Framer? Join the Community
Return to index
Alexandre Plennevaux
Posted Oct 08 - Read on Facebook

Hello! I've imported a sketch file inside which there is a layer "card" that I'd like to use to generate a list of card via a for loop. I can't seem to get the code creating the layer instance right. This is what I've tried:

allCards = []

for i in [0...10]
card = new Layer sketch.card
width: scroll.width
height: 400
x: 0
y: (150 + 4) * i

allCards.push(card)

1 Comments

Niels van Hoorn

You could create a new layer and set the props afterwards:
allCards = []

for i in [0...10]
. card = new Layer sketch.card
. card.props =
. width: scroll.width
. height: 400
. x: 0
. y: (150 + 4) * i
.
. allCards.push(card)

Hope this helps

Read the entire post on Facebook