This example demonstrates how one can use DeviceMotionEvent
to mimic Pebble's compass application.
Works best on a mobile device!
This example is a simpler version of Pebble's compass application. The code subscribes to device motion events where available and uses some animated fake heading where it doesn't exist (e.g. on your desktop).
Although the actual draw code, e.g. draw_ticks()
is an interesting example of Rocky's drawing
routines, the focus of this example is to show how one can leverage today's web APIs
(here: window.addEventListener('deviceorientation', yourFunction)
) to mix them with Rocky.js.