Language: JavaScript and HTML | VB/C#/C++ and XAML

Responding to motion and orientation sensors (Windows Runtime apps using JavaScript and HTML)

Applies to Windows and Windows Phone

Purpose

Developers can create Windows Store apps that use sensors to detect and respond to a variety of user movements. For example, an accelerometer can detect when the user moves, or shakes, a device; an inclinometer can detect when the user tilts a device, and a compass can detect when the user changes the device orientation.

In this section

TopicDescription

Quickstart: Responding to user movement with the accelerometer

You can use the accelerometer to respond to user movement in an app written in JavaScript. An app based on an accelerometer typically uses only one or two axes for input. However, it may also use the shake event as another input source.

Quickstart: Determining angular velocity with the gyrometer

You can use the gyrometer to detect changes in user movement with an app written in JavaScript. Gyrometers complement accelerometers as game controllers: the accelerometer can measure linear motion while the gyrometer measures angular velocity (or rotational motion).

Quickstart: Determining current heading with the compass

You can use the compass to determine the current heading with an app written in JavaScript.

Quickstart: Determining pitch, roll, and yaw with the inclinometer

You can use the inclinometer to determine pitch, roll, and yaw with an app written in JavaScript. One common example is a flight simulator, which maps the three axes of the inclinometer (X, Y, and Z) to the elevator, aileron, and rudder inputs of the aircraft.

Quickstart: Retrieving the quaternion and rotation matrix

You can use the Orientation sensor to retrieve a Quaternion and rotation matrix with an app written in JavaScript. Developers typically use this data to control complex games.

Quickstart: Determining device orientation

You can use the SimpleOrientation sensor to determine device orientation with an app written in JavaScript.

 

 

 

Show:
© 2014 Microsoft. All rights reserved.