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

What is Framer? Join the Community
Return to index
Joshua Tucker
Posted Sep 28 - Read on Facebook

Anyone been able to use "deviceorientation" with your Framer projects? I am trying to print out my beta ( x ), gamma ( y ), and alpha ( z ) values to start, just to ensure I'm capturing the data. However, it will only print out my alpha ( z ) value. Any ideas?

orientation = (event) ->
x = event.beta
y = event.gamma
z = event.alpha

window.addEventListener "deviceorientation", (orientation) ->
# This will only print if it's print z
print y


Joshua Tucker

Thanks. I'll give it a look!

Joshua Tucker

To follow up: got it working. I think part of it was I didn't have a conditional to state what to do whether it detected an orientation event or not, so sometimes it would report, sometimes it wouldn't (also a boolean of true associated all the deviceorientationevents which is what I needed).

James Muirhead

Joshua Tucker Could you share some more of your code re: device orientation?

James Muirhead

Thanks a bunch!!

Jonas Treub
Read the entire post on Facebook