Detecting device movement


show more Detecting device movement provides you with in-depth training on Developer. Taught by Joe Marini as part of the Mobile Web Design & Development Fundamentals show less
please wait ...

Detecting device movement

Beyond capturing just simple changes in device orientation, you can also detect and respond to more complex device motion events. You can do this by listening to the DeviceMotion event, and there's also an onDeviceMotion event off of the Window object. So when you register an event handler for DeviceMotion, the event handler function will be called with an event that describes a DeviceMotion event. The DeviceMotion event contains several properties. There is the property for acceleration, which itself contains properties X, Y, and Z that describe acceleration in meters per second squared on three different axes: forward and back, up or down, and left to right.

There is also the accelerationIncludingGravity property, which is the same as the regular acceleration property, but it includes the effects of gravity. The rotationRate contains properties alpha, beta, and gamma that measure the rotation speed for three rotation axes. And then there's the interval, which is the number of mi...

Detecting device movement
Video duration: 5m 21s 5h 47m Beginner

Viewers:

Detecting device movement provides you with in-depth training on Developer. Taught by Joe Marini as part of the Mobile Web Design & Development Fundamentals

Subjects:
Developer Web
Software:
HTML
Author:
please wait ...