API Documentation

for 0.0.1
Show:

Motion Class

Constructor

Methods

computeGravityVector

() private

Method to compute the gravity orientation vector based on accel including gravity. The result can also be get through the event onAccelerationGravityVector

computeUserAcc

() private

Compute the values for the acc on devices that gives "undefined" for the event.acceleration prop (some Android)

getAcc

() Object

Method to get the accel values including gravity. The result can also be get through the event onAccelerationIncludingGravity

Returns:

Object:

acc object composed by x, y & z components

getGravityVector

() Object

Method to get the gravity orientation vector based on accel including gravity. The result can also be get through the event accelerationGravityVector

Returns:

Object:

gravityVector object composed by x, y & z components

getSmoothedAcc

(
  • factor
)
Object

Method to get the filtered accel including gravity.

Parameters:

  • factor Number

    The number to use for the filtering aglorithm (0.07 gives good results)

Returns:

Object:

smoothedAcc object composed by x, y & z components

getUserAcc

() Object

Method to get the accel values without gravity. The result can also be get through the event onAcceleration

Returns:

Object:

userAcc object composed by x, y & z components

Properties

_accAvailable

Boolean

true if the acceloremeters are available on the device, false otherwise

Events

acceleration

Fired when a new acceleration is available

accelerationGravityVector

Fired when a new gravity vector is available

accelerationIncludingGravity

Fired when a new acceleration including gravity is available

rotationrate

Fired when a new rotationrate data is available