Class: MotionInput

MotionInput

Module that wraps the motion-input library and creates a stream of vectors from the accelerometers and gyroscope.

Output is defined in the same order, unit and directions as in the DeviceMotion specification:

  • 0 - accelerometer X
  • 1 - accelerometer Y
  • 2 - accelerometer Z
  • 3 - gyro around Z (alpha - yaw)
  • 4 - gyro around X (beta - pitch)
  • 5 - gyro around Y (gamma - roll)

Constructor

new MotionInput()

Source:
Example
import * as lfo from 'waves-lfo';
import * as lfoMotion from 'lfo-motion';

const motionInput = new lfoMotion.source.MotionInput();
const logger = new lfo.sink.Logger({ time: false, data: true });

motionInput.connect(logger);

motionInput.init()
  .then(() => motionInput.start())
  .catch(err => console.log(err.stack));

Methods

start()

Start the stream.

Source:

stop()

Stop the stream.

Source: