Giter Site home page Giter Site logo

compios5's Introduction

I love Device APIs, even the non-standard ones. This is a web-based compass application for iOS5 devices.

It's been tested on iPhone 4 hardware. Should work fine on iPhone 4S. Layouts are probably slightly strange on the iPad.

Try it out directly on http://jamesgpearce.github.com/compios5/

This uses the browser's new webkitCompassHeading property of the device orientation event. http://lists.w3.org/Archives/Public/public-geolocation/2011Jul/0014.html

The compass itself is created entirely with CSS.

A couple of implementation notes:

  • There's easing on the rotation to make it a little less jerky, but this has to be turned off whenever the compass spins through north. 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. It's not quite stationary on a portrait->landscape flip, but great the other way.

This won't work on any device apart from a real iPhone. There's no way to simulate heading changes in the iOS simulator that I can find.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.