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

What is Framer? Join the Community
Return to index
Matt Marriotti
Posted Nov 17 - Read on Facebook

How can I upon tapping a layer, get the X/Y position of the tap relative to the layer's area?

If I grab the users tap X/Y position, it's relative to the screen, which is fine, but when I grab those coordinates upon tapping a rectangle because I want to make a Ripple effect on that rectangle (like Material Design), I need to determine the X/Y of the tap within the box's area, not the screen's area.

I've been looking at the demo for the material effect, but I'm struggling to pull the position on the tap in my project.

I figure there is some means to subtract the overall location of the rectangle in relation to the screen, but I'm struggling on what things to subtract out.


Balraj Chana

I did this a while back when I was experimenting with material design in Framer. You can use midX, midY coordinates of a click to determine its position relative to the layer. Hope this helps.

Matt Marriotti

Aw thats great! especially since you made a function for it that's easy to build in. Thanks!

Balraj Chana

You're welcome dude, anytime!

Aaron James

Balraj, thanks for posting your example function above. *high five*

Balraj Chana

You're welcome Aaron, anytime :)

Jordan Robert Dobson

My pointer module at helps with exactly this issue. Offset or screen values are returned.

Andrew Nalband

Use the pointer module, yo - it's the beez kneez

Read the entire post on Facebook