How to move an object via Gyro as it's made in GWD?
I'm struggling to handle window.addEventListener('devicemotion') , but I can't get it how to apply this data for object moving. Gear S3 Tizen 2.3.2
window.addEventListener('devicemotion', function(e) {
ax = e.accelerationIncludingGravity.x;
ay = -e.accelerationIncludingGravity.y;
az = -e.accelerationIncludingGravity.z;
rotx = e.rotationRate.alpha;
roty = e.rotationRate.beta;
rotz = e.rotationRate.gamma;
object_gyro.style.left = ??? + "px";
object_gyro.style.right = ??? + "px";
object_gyro.style.top = ??? + "px";
object_gyro.style.bottom = ??? + "px";
});
#object-gyro{
z-index:1;
width: 100px;
height: 100px;
background-color: black;
position: absolute;
margin: auto;
left: 0;
right:0;
bottom:0;
top:0;
}