2011-06-19 41 views

回答

2

找到这个片段从here与谷歌搜索。

window.ondevicemotion = function(event) { 
    ax = event.accelerationIncludingGravity.x 
    ay = event.accelerationIncludingGravity.y 
    az = event.accelerationIncludingGravity.z 
    rotation = event.rotationRate; 
    if (rotation != null) { 
    arAlpha = Math.round(rotation.alpha); 
    arBeta = Math.round(rotation.beta); 
    arGamma = Math.round(rotation.gamma); 
    } 
} 
+0

什么语言是什么? JavaScript的? – OOProg

+0

是的,我不知道Safari支持任何其他脚本语言。 – Bemmu

相关问题