Introduction

Using the orientation of your mobile device to control a game was one of the first “wow” moments of the smartphone gaming era. With the support for device orientation and acceleration in the browser, that capability is now within your reach as an HTML5 game developer. This chapter examines the DeviceOrientation event API, which has two useful events: device orientation and device motion. A third event, compass, is also available, but unless you have a long-running application that needs precise direction details, you can safely ignore this event.

Get Professional HTML5 Mobile Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.