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

What is Framer? Join the Community
Return to index
Harry Brignull
Posted Mar 18 - Read on Facebook

How do you get the x or y coordinate of a sublayer on the window itself, rather than on the parent layer? thanks!

10 Comments

Joshua Tucker

Hey Harry! You can use layer.screenFrame. layer.screenFrame.x/y/width/height. It's documented here: http://framerjs.com/docs/#layer.screenFrame

Harry Brignull

Perfect, thanks Joshua!

Harry Brignull

In a scenario where mychild is a child of myparent, can I write something like "mychild.on Events.Click, (event, layer) -> myparent.animate({..." So in other words, if I write a function that listens for an event and does stuff to the child, can I manipulate the parent in that function?

Joshua Tucker

When you say "manipulate the parent," do you mean can you transform properties/animate parent layer on a child/subLayer event? You can! Just write in whatever you want to do within the event.

Harry Brignull

Ah OK. I must be making a dumb mistake elsewhere and getting confused. Thanks!

Joshua Tucker

Harry Brignull No worries, I am prone to make very dumb mistakes too, don't worry :).

Here's an example.

Harry Brignull

Here's the problem I'm working on.

Joshua Tucker

Harry Brignull Another great way to get feedback is to share your project (if you are able to – if you're not under an NDA or something). You can do from the Share button in the top right hand side. The link it gives you will allow us to download your project and play with your code.

Hold on to the link(s) you generate for your project because if you want to remove them from online, you can email [email protected] with those links saying you wish to remove them and they'll do it!

Harry Brignull

Right then. I'm slightly ashamed of my code - I'm only a beginner. Here it is: http://share.framerjs.com/he6qvuj4ptx1/

Joshua Tucker

Harry Brignull No need to be ashamed – we are all learning here!

Read the entire post on Facebook