Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

collective-soundworks/motion-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

motion-input

Module that provides unified motion data across platforms (iOS and Android) and browsers.

Installation

npm install [--save] collective-soundworks/motion-input

Example

motion-input

Usage

const motionInput = require('motion-input');
 
motionInput
  .init(['accelerationIncludingGravity'])
  .then(([accelerationIncludingGravity]) => {

    if (accelerationIncludingGravity.isValid) {
      accelerationIncludingGravity.addListener(val => {
        console.log(val) 
      });
    }
    // ...
  })
  .catch(err => console.error(err.stack));

Warning

Due to some weird (buggy ?) behavior in Chrome and and Firefox, if you need to use both 'acceleration' and 'orientation' modules, 'acceleration' should always be initialized and listened before 'orientation'.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •