Phonegap加速度计y值(度) [英] Phonegap Accelerometer y value to degrees
本文介绍了Phonegap加速度计y值(度)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Phonegap加速度计似乎返回y值,如下所示:
Phonegap accelerometer seems to return y values as below:
// +10 y axis = straight up = 0/360 deg
// -10 y axis = straight down = 180 deg
// flat y axis = 90/270 deg
我的问题是,如何将y轴转换为给定度?
My question is, how do I convert this y axis to the given degrees?
此外,由于它是电话间隙,我假设所有设备的这些值都相同。
Also, as it's phonegap, I'm assuming these values are the same for all devices. if anyone knows otherwise please let me know.
推荐答案
尝试一下:
deg = acceleration.y / 10 * 90;
当我做类似的事情时,我认为这对我有用。
I think that worked for me when I was doing something similar.
这篇关于Phonegap加速度计y值(度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文