I have a proposal for exposing device orientation in the browser. It is a pretty simple api that allows you to monitor motion changes from Javascript.
For example:
navigator.orientation.watchOrientation(draw);
function draw(o) {
// o.x, o.y, o.z
}
o in function draw is a vector in three dimensional space in meters /
(seconds^2) units.
This allows you to do some revolutionary stuff on the web. This is a simple test web page that moves a ball around a web page. I am just loading this web page directly with XUL Runner on Windows Mobile Professional 6.
This only supports exists on HTC devices but i do expect other devices that have accelerometers to have implementations.
I am tracking this feature in bug 485943. Please check it out and let me know what you think.
2 Comments
This is an acceleration function, not an orientation function. We probably need both – i.e. what direction does the device point in (like a compass), plus what acceleration is it undergoing. So I think the naming should be changed
The only comment I can think of is “Do it! Do it now!”