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

What is Framer? Join the Community
Return to index
Eric Wyman
Posted Jun 14 - Read on Facebook

Having some trouble targeting a sublayer in an animation. There are several sublayers named "preview" across different groups. What is the best way to target them. Have an action navEmail.right.onTap -> that opens a set of checkboxes and should move all layers named "preview" as well.

1 Comments

Eelco Lempsink

Hi Eric, there are some proposals (like this one: https://github.com/koenbok/Framer/pull/336) to make this easier in Framer.

But for now, there are a couple of ways you can go from here, I ordered them from straightforward to more advanced technique:

1. Rename the ‘preview’ layer variables so each has a unique variable name so you can refer to them later.

2. Build up the array of ‘preview’ layers along the way (add the preview layer to the array after setting up the message, this way you could still reuse the ‘preview’ variable name like you do currently)

3. Refactor your code to build up the messages (plus sublayers) in a loop. Then you can either collect the preview layers in an array (like you would do with 2) or, add the event handler to each preview layer, but because you do it in a loop, you only have to write the code once.

This is a great article to learn more about how to use arrays and loops: https://medium.com/framer-prototyping/code-less-achieve-more-with-arrays-in-framer-c43594d13d59

Read the entire post on Facebook