Just a quick question, how does FramerJS handle Sublayers with the same name of different parent layers?
I imported those Layers from a Sketch File I'm working on.
SubLayers work the same way as any other layer. If you have two identically named layers with the same nesting depth, then Framer will return the layer with the highest index i.e. the first layer on top and ignore the others.
In your case, there won't be any conflict as your parent names are different.
I'm a little bit confused. How do I, for example, add states to Layer1 of ParentA? And how would I add others to Layer1 of ParentB?
Hey Julian Veerkamp - here's two ways you could go about this:
1. First, make sure that any artboards created after your first one are made visible in Framer. Then, you could loop over the subLayers of a specific artboard, and select the layer there. See below.
2. If your artboards contains multiple layers, it's also possible to target the layer directly by referencing its array index. Like this:
print sketch.artboardB.subLayers (first layer)
Thank you very much, Benjamin Den Boer. One more questions. After printing the names of the sublayers i've noticed that every layer has an ID. Is this ID unique for every Layer? And can I also use this ID change values of the Layer?And regarding the the array Index. Is there a better option than doing .sketch.artboardB.subLayers.subLayers.visible, when I want to access a Sublayer of a SubLayer of a ArtBoard?
You're welcome Julian! The ID is unique, indeed - and you can use it (layer.id) to select or target layers (with conditional statements, for instance). As for the indeces, that's one way to do it if you can't target layers by name - but in this case it's probably easier to simply rename the layer within Sketch and target it directly.