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

What is Framer? Join the Community
Return to index
Benny Chew
Posted Apr 04 - Read on Facebook

Hi Koen Bok Benjamin Den Boer is there something like a layer.globalX or layer.convertLocalToGlobal() in Framer? I looked into layer.screenFrame but that didn't solved my problem. I have pages in a PageContainer I want to detect when each page goes beyond the global 0 x axis.

7 Comments

Benjamin Den Boer

Hey Benny Chew - yes. Couple of things:
1. Canvas.width/height (entire window)
2. Screen.width/height (device screen)
3. Framer.Device.screen.x/y/width/height (same as screen, plus x/y)

There's also Utils.globalLayers() - which is named similarly to the function names you've described - but it's for renaming imported layers so they can be targeted directly. (sketch.tabBar > tabBar)

Benny Chew

Thanks, these are very handy. I actually meant converting a local x or a sub layer in relation to the screen root, outputting a global x.

Benny Chew

I tried to figure it out (math arghh :) and I think I did. It's simple. Global x of sub layer in relation to screen = sub layer local x - parent layer (page container) x.

Fran Pérez

Benny, try layer.screenFrame :)

Koen Bok

Also, layer.canvasFrame

Benny Chew

Thanks guys. I think I finally got it to work. What I wanted is when you drag the next card will gradually show itself (opacity), you know. Only problem is the last card, it needs 56 px more right padding, but I don't know whats wrong. I also had problems importing a layer with transparency in it, the navbar, had to manually import it with a opaque bg.

Benny Chew
Read the entire post on Facebook