Skip to content

Device Orientation

March 30, 2009

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.

Device Orientation on YouTube

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.

From → Uncategorized

2 Comments
  1. Chris permalink

    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

  2. Ian M permalink

    The only comment I can think of is “Do it! Do it now!” :)

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.