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

What is Framer? Join the Community
Return to index
John Grendon Enderby
Posted Jul 07 - Read on Facebook

Hello everyone, another quick one from me. Has anyone tried importing objects from Sketch that were imported as not visible and then tried to show them and it not work?

Opacity is 1 on the layers and the layer inspector panel shows that they should be active and visible, but they aren't. If I import them as visible and then hide them by default I have no problems. Wondering if this is an issue?

19 Comments

Balraj Chana

Visibility and opacity are 2 different properties. Layers that you’ve hidden in Sketch are also imported, but with visibility set to "false" by default (opacity is unchanged). To make the imported layer visible in Framer, just set the visibility to true e.g. sketch.layerName.visible = true

John Grendon Enderby

Yeah I have, but when i try to show them on click the are "visible" but not actually visible. And the opacity is set to 1 and the z-index isn't an issue, I have also tried changing group depth and reordering the folders on import.

John Grendon Enderby

But only if they're hidden in Sketch on import

Dan Clarke

saw this on the site, just in beta?
"Layers that you’ve hidden are also imported, but with visibility set to "false" by default. The opacity property is left unchanged. This feature is currently only available in Sketch Beta."

John Grendon Enderby

It only seems to be happening with two groups in my sketch file. Another one works perfectly.

John Grendon Enderby

Dan Clarke that might be it! It was working fine two weeks ago though...

John Grendon Enderby

Nope, just dl'd the beta. Not that

John Grendon Enderby

I just have to hack it for now I guess

Balraj Chana

John - Can you share your file? Also a screenshot of the expanded layers list in Sketch would be useful. If it works for one, then it should work for all.

John Grendon Enderby

I can't share the actual project I'm afraid as it is something we are working on at the moment, but I cant send the image of the layers (attached) and I have thrown together a gist on github that you should be able to access here: https://gist.github.com/johnend/2031cedddefebe50b6e3 to view the code.

John Grendon Enderby

Hopefully that is enough

Balraj Chana

Thanks for sending these over. Which line is causing the issue? From your layers list, I see that there are groups which are ignoring the mask. Have you tried placing the masked groups inside a parent group?

John Grendon Enderby

Yeah

John Grendon Enderby

the issue is when the two list groups are imported when hidden

John Grendon Enderby

But the another group works fine when imported when hidden, the other thing that wasn't working was that code we talked about earlier (the if statement) it's commented out in the gist.

John Grendon Enderby

In the gist file I have imported the list1 and list2 groups as visible and then had to hide them (lines 37 and 38)

John Grendon Enderby

This is how I have it working at the moment, recorded a video for the demo so it should be ok but would like to work these things out for the future.

Balraj Chana

The group names in the gist file are different from your layers list so it's hard to tell from here. Best bet is to keep all groups visible in sketch and then set the visibility to false for the layers in Framer, which is what you've done. That way you'll know if everything has been imported correctly. Then you can narrow it down to the code.

The if statement is placed in the global scope so it will execute on page load. Assuming that oneItem and twoItem are both visible in sketch, then mask2 should be hidden.

John Grendon Enderby

Ok cool. I will have a look tomorrow when I've been away from it for a night. Thanks so much for your help. Much appreciated. :)

Read the entire post on Facebook