Brand viagra I love Device APIs, brand viagra even the non-standard ones. Brand viagra I think they are going to hoist the web up onto its next level of innovation, brand viagra usage, brand viagra and ubiquity.
Brand viagra I was pleased to discover that iOS5 includes a new one, brand viagra tucked away as a new property, brand viagra
webkitCompassHeading, brand viagra mentioned by Apple on the W3C lists a little while back.
Brand viagra Previously this event’s orientation data was great for relative rotation, brand viagra but its absolute value was arbitrary with respect to the real world. Brand viagra The new property gives a heading that is meaningful for real-world navigation. Brand viagra (There is also a
webkitCompassAccuracy property that tells you how well it is doing.)
Brand viagra So I lashed up Compios5, brand viagra a small web-based compass application, brand viagra to show it off. Brand viagra It requires, brand viagra of course, brand viagra a real iOS5 device to work. Brand viagra (It’s been tested on iPhone 4 hardware. Brand viagra Should work fine on iPhone 4S. Brand viagra Layouts are probably slightly strange on the iPad.)
Brand viagra The compass itself is created entirely with CSS, brand viagra with a few programmatically created elements for the labels and arrows. Brand viagra Designers: please issue pull requests to make it look nicer!
Brand viagra The code is here. Brand viagra A couple of implementation notes:
- There’s easing on the rotation to make it a little less jerky, brand viagra but this has to be turned off whenever the compass spins through north. Brand viagra CSS transitions do not wrap-around transforms.
- window.orientation needs to be added to the heading so that a landscape view still points to physical north.
- Media queries detect orientation so that the compass stays in the center of the screen. Brand viagra It’s not quite stationary on a portrait->landscape flip, brand viagra but great the other way.
Brand viagra As I said, brand viagra this won’t work on any device apart from a real iPhone. Brand viagra There’s no way to simulate heading changes in the iOS simulator that I can find. Brand viagra But if you’ve upgraded, brand viagra or have a shiny new iPhone 4S, brand viagra please take it for a whirl.