Questions tagged [deviceorientationevent]

6 questions
28
votes
2 answers

The simplest way to solve gimbal lock when using DeviceOrientation events in javascript - How to make a perfect spirit level/bubble level app

Starting with... window.addEventListener("deviceorientation", handleDeviceTilt); function handleDeviceTilt(event){ // Here we can use event.beta, event.gamma // Note that we don't need event.alpha because that's just the compass as we // don't need…
3
votes
1 answer

iOS DeviceOrientationEvent API & Typescript

I have the following setup for an @on:clock callback that is designed to ask the user for permission to the DeviceOrientationEvent API for iOS Safari devices: const setDeviceOrientationPermission = async () => { if (typeof…
Micheal J. Roberts
  • 3,735
  • 4
  • 37
  • 76
2
votes
1 answer

DeviceMotionEvent.requestPermission() throws NotAllowedError

I have a web page that I'm loading in Safari on iOS 13.4.1. The web page calls DeviceOrientationEvent.requestPermission() and in the .catch following the .then I'm seeing this error: NotAllowedError: Requesting device orientation or motion access…
uncle brad
  • 201
  • 1
  • 3
  • 6
1
vote
1 answer

How can I use DeviceOrientationControls with scroll in iOS 13?

I am attempting to use the data received from DeviceOrientationEvents to animate (rotate) a camera in three.js using three's DeviceOrientationControls. The controls are updated upon every animation frame, and everything works as I would expect.…
1
vote
0 answers

devicemotion api device coordinate frame

The DeviceMotionEvent API appears to provide acceleration data with reference to the world's coordinate frame. x - Represents the acceleration upon the x axis which is the west to east axis y - Represents the acceleration upon the y axis which is…
David Callanan
  • 5,601
  • 7
  • 63
  • 105
0
votes
0 answers

JavaScript - Detect mobile rotation but according to another frame of reference

I'm trying to implement deviceorientation but the angles I get are changed when I rotate the mobile around its own axis Specs What I'm trying to do is detect rotation according to another reference, kinda like the diagram below Diagram (async…