Getting started

A quick start guide to get up and running quickly with MotionStack

Download the latest MotionStack release

You can download a copy of the latest version of the MotionStack (v1.1.2) here.

Interacting with MotionStack

Once the library has loaded you can then call MotionStack APIs to interact with them from your web page.

All MotionStack APIs follow the same conventions in their lifecycle and usage. First, you need to create a new instance of the API you want. For example, to create a new instance of the ShakeProgress API for registering shake gestures, simply write

var shakeProgress = new MotionStack.ShakeProgress();


Then, call start( – passing in a callback function – ) and stop() whenever you want to start and stop listening for data. A simple example logs the progress as a user shakes their mobile device and stops once the shaking gesture is completed:


shakeProgress.start(function(data) {
  // Log data as it arrives (from 0 to 1)
  console.log(data.progress);

  // If the ShakeProgress event finishes,
  // stop listening for further events.
  if(data.progress === 1) {
    shakeProgress.stop();
  }
});