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

What is Framer? Join the Community
Return to index
Edward Sanchez
Posted Feb 07 - Read on Facebook

How can I reference a layer in a row of layers?

For example:
rows = 6
[1..rows].map (a) ->
cellLayer = new Layer
backgroundColor: "#FFF"
width: width
height: height
borderRadius: 6
x: 200
y: a * (height + gutter) + startDelta

If want to drag the 3rd row and animate the 4th row.

2 Comments

Edward Sanchez

Answer: You need to create another array outside the loop and then append the layer to the array inside the loop

myOutsideArray.push(cellLayer)

Then you can do things like myOutsideArray[2].style and it'll change the style of cellLayer

Marcelo Eduardo Oliveira

Hi Edward, my approach would be to use arrays instead of the map function.

something along these lines:

http://share.framerjs.com/z426lr95szoo/

Read the entire post on Facebook