Hacker Newsnew | comments | ask | jobs | submitlogin
Device Orientation in HTML5 (tilt your computer if you have a MacBook & Chrome) (html5rocks.com)
102 points by pud 852 days ago | comments


asadotzler 852 days ago | link

The last three versions of Firefox have supported the W3C device orientation spec. Before that, and going all the way back to Firefox 3.5 more than two years ago, Firefox supported a vendor prefixed version.

-----

ComputerGuru 852 days ago | link

Or an IBM/Lenovo ThinkPad.

They all (ingeniously) use the sudden-drop detection that prevents hard drive head crashes to double as an accelerometer.

-----

baddox 852 days ago | link

> They all (ingeniously) use the sudden-drop detection that prevents hard drive head crashes to double as an accelerometer.

I assume it's really the other way around—a "sudden-drop detector" is nothing more than an accelerometer.

-----

ComputerGuru 852 days ago | link

Yes and no.

It's one of those things that are obvious in retrospect, but computers have had accelerometers used for sudden motion sensing for decades now, and most manufacturers employ this tech in some form or the other in their upper-end modules.

Yet it took one bright individual to figure out that there's no point in using the accelerometer just for SMS, when in fact, its API can be exposed to the world for whatever other accelerometer-related needs. I don't know why other manufacturers haven't followed suite, but given the state of the industry I would not be surprised if patents are, in one way or the other, to blame.

-----

terinjokes 852 days ago | link

Many years ago, 2006, I was using the sudden-drop detection in my iBook G4 to know when people were walking down the hallway to my office.

-----

adriand 851 days ago | link

Please provide more details on how you accomplished this, it sounds interesting.

-----

reledi 851 days ago | link

Wouldn't you get false positives every time you typed?

-----

terinjokes 851 days ago | link

Yes, but due to how the structure was (poorly? likely…) constructed, the movement caused by someone walking down the hall was much larger than me typing.

-----

bitsoda 852 days ago | link

It took me a minute to figure out how the site achieved its sorcery, but then was reminded of the Sudden Motion Sensor.

For the curious: http://en.wikipedia.org/wiki/Sudden_Motion_Sensor

-----

smokinjoe 851 days ago | link

My friend has one but running Ubuntu and it doesn't work.

Is this exclusive to Windows/OSX?

-----

ComputerGuru 851 days ago | link

The hardware is there, I guess Ubuntu just doesn't have the drivers for this chip or your friend doesn't have them installed.

In theory, this is cross-platform.

-----

zobzu 852 days ago | link

About 50% of the things on this page aren't HTML5, but chrome-only features.

Bleh for standardization, really.

-----

nkassis 852 days ago | link

If you are building something for wide market use then definitively don't use these new features until they are supported by multiple vendors. But before standardization can happen things have to be tried out, I don't see what all the negativity is about when it comes to new features in chrome (I don't get the same vibe with Firefox only features).

It's better, in my opinion, to have a working prototype of a feature working and used by some early adopters than to build standards in a vacum.

Those early adopters need to know those features my disappear or the apis change and be ready to fix their code.

-----

gcp 851 days ago | link

The API they use was standardized, and supported by multiple browsers since long. The page is written to only work in WebKit browsers.

There is no need or sense in defending this behavior. It's bad, and shortsighted.

-----

mp3geek 852 days ago | link

Pity the developer didn't include -moz extensions, given the use of -webkit extensions you'd think he doesnt care about anything but Webkit.

-----

ntkachov 852 days ago | link

Most of them are the same but with -moz instead of -webkit. Don't forget these are slides not blog posts. He had to pick one or risk too much info.

-----

mgcross 851 days ago | link

Yeah, it's a couple years old now: http://news.ycombinator.com/item?id=1272481 At this point, much of the CSS3 demonstrated wouldn't require a vendor prefix at all.

-----

potch 852 days ago | link

wrote a labyrinth demo back in the day to demo the Firefox-prefixed version of the API. I've updated it here: http://potch.me/labyrinth/

-----

nostromo 852 days ago | link

It seems to only react to two axes (beta and gamma -- in other words, if I rotate my MBP on a flat surface, nothing happens) -- is anyone on a device that provides alpha as well? I know the iPhone does, but this demo doesn't seem to work in Mobile Safari.

-----

cmelbye 852 days ago | link

Doesn't that require a gyroscope? Most devices that would work with this only have accelerometers.

-----

shalmanese 852 days ago | link

I'm still waiting for someone to build a popular whack based interface based on this data. I'd love a photo album where I would tap the side of my screen to advance to the next/previous photo.

-----

PAPPP 852 days ago | link

The hdaps Linux kernel driver for Thinkpads' sensors (don't know about the other flavors) can export the data as a joydev, which can be mapped arbitrarily - I've tried things like desktop switching by hard taps to either side of the keyboard, but it's more of a neat gimmick than a useful interaction mode. Some (severely out of date) scripts here: http://www.thinkwiki.org/wiki/HDAPS (no HTML in comments?)

-----

thatjoshguy 851 days ago | link

See SmackBook Pro from 2006 http://blog.medallia.com/2006/05/smacbook_pro.html

-----

jurre 852 days ago | link

doesn't seem to work on my 2011 air

-----

gkoberger 852 days ago | link

Unfortunately it doesn't work with Airs, since they don't have an accelerometer. I believe the only reason MBPs have them is so they can lock up the hard drive if a computer is dropped.

-----

AdamGibbins 852 days ago | link

Nor mine, I suspect its because the accelerometer is designed to halt the disk if it detects sudden movement. There is no hard disk in the airs thus it has no need for an accelerometer.

-----

0x0 852 days ago | link

I'm guessing they left out the motion detector, since the air is fitted with an SSD, and there's no hard drive that needs protection.

-----

daniel_iversen 852 days ago | link

it would be cool if GMail and other data sensitive web applications used these APIs so that it would log you out of the web service if your computer had a lot of motion (e.g. someone running away with it).

-----

ntkachov 852 days ago | link

Interesting idea but it would make gmail impossible to use on a train or bus.

-----

tommi 851 days ago | link

All motion is not equal. You could probably build some sort train and bus motion profile and compare against that.

-----

zobzu 852 days ago | link

true :D

-----

daniel_iversen 851 days ago | link

correct, back to the drawing board! :)

-----

taylorbuley 852 days ago | link

No JS required w/CSS media query, e.g. @media only screen and (orientation: landscape) {...}

-----




Lists | RSS | Bookmarklet | Guidelines | FAQ | DMCA | News News | Feature Requests | Bugs | Y Combinator | Apply | Library

Search: