You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some low-end mobile devices (like my old Moto E 1st gen, which doesn't have a gyroscope) may give a "false positive" for device orientation: it passes the window.DeviceOrientationEvent availability test, but deviceorientation event data alpha, beta, and gamma are always null, so that parallax doesn't work at all for these devices.
Please go further in device orientation event detection, checking whether rotation data alpha, beta, and gamma are null, and falling back to device motion event if it's the case (note, however, that even devicemotion event's rotationRate.alpha, rotationRate.beta, and rotationRate.gamma may also be null, so that, in the last case, one should fall back to x/y/z acceleration data).
There's a simple HTML test page which can be used to test a mobile device's motion/orientation capabilities, whose code is published at mobiForge. The HTML code is transcribed below:
<DOCTYPEhtml><html><head><script>functioninit(){//Find our div containers in the DOMvardataContainerOrientation=document.getElementById('dataContainerOrientation');vardataContainerMotion=document.getElementById('dataContainerMotion');//Check for support for DeviceOrientation eventif(window.DeviceOrientationEvent){window.addEventListener('deviceorientation',function(event){varalpha=event.alpha;varbeta=event.beta;vargamma=event.gamma;if(alpha!=null||beta!=null||gamma!=null)dataContainerOrientation.innerHTML='alpha: '+alpha+'<br/>beta: '+beta+'<br />gamma: '+gamma;},false);}// Check for support for DeviceMotion eventsif(window.DeviceMotionEvent){window.addEventListener('devicemotion',function(event){varx=event.accelerationIncludingGravity.x;vary=event.accelerationIncludingGravity.y;varz=event.accelerationIncludingGravity.z;varr=event.rotationRate;varhtml='Acceleration:<br />';html+='x: '+x+'<br />y: '+y+'<br/>z: '+z+'<br />';html+='Rotation rate:<br />';if(r!=null)html+='alpha: '+r.alpha+'<br />beta: '+r.beta+'<br/>gamma: '+r.gamma+'<br />';dataContainerMotion.innerHTML=html;});}}</script></head><bodyonload="init()"><divid="dataContainerOrientation">
No device orientation data
</div><divid="dataContainerMotion">
No device motion data
</div></body></html>
The text was updated successfully, but these errors were encountered:
I'm really tempted to just agree with @theOGl and close this issue, but that's just me being lazy 😋
The hardest part about this is developing without having access to the hardware in question. Keeping this open until someone with a device donates either a pull request or the device itself.
Some low-end mobile devices (like my old Moto E 1st gen, which doesn't have a gyroscope) may give a "false positive" for device orientation: it passes the
window.DeviceOrientationEvent
availability test, butdeviceorientation
event dataalpha
,beta
, andgamma
are alwaysnull
, so that parallax doesn't work at all for these devices.Please go further in device orientation event detection, checking whether rotation data
alpha
,beta
, andgamma
arenull
, and falling back to device motion event if it's the case (note, however, that evendevicemotion
event'srotationRate.alpha
,rotationRate.beta
, androtationRate.gamma
may also benull
, so that, in the last case, one should fall back to x/y/z acceleration data).There's a simple HTML test page which can be used to test a mobile device's motion/orientation capabilities, whose code is published at mobiForge. The HTML code is transcribed below:
The text was updated successfully, but these errors were encountered: