This lab is an example of displaying a 3d representation of a device's current orientation using the deviceorientation event reported by mobile devices.
The logic behind the event values is explained by these Dev.Opera and MDN articles.
Three values are returned by the event - alpha (α), beta (β) and gamma (γ) - that relate to the orientation of the device.
For this lab, the three values are used as rotation values for the X, Y and Z coordinates of the on-screen device.
This is a basic implementation that doesn't use Euler angles or Quaternions (etc) and therefore suffers from Gimbal Lock. (Read More Here).