0.0.5 • Published 4 years ago

@zonesoundcreative/web-devicemotion v0.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

Device Motion

This is a device orientation / velocity listener.

(Still in Development)

How to use

Import

import DeviceMotion from '@zonesoundcreative/web-devicemotion'

Usage

First, new an instance of Devicemotion with optional parameter.

let deviceMotion = new DeviceMotion(smooth, listenerfunction);

Parameter:

  • smooth: BOOLEAN Use one euro filter to smooth value or not.(default: false)

  • listenerfunction: function be callback when device orientation has been read.

READ DATA

Access device motion data from deviceMotion instance. The datas are in JSON format.

    //orientation
    deviceMotion.orient = {
        pitch : xxx,
        raw : xxx,
        yaw : xxx
    }

    //velocity of orientation
    deviceMotion.orientVel = {
        pitch : xxx,
        raw : xxx,
        yaw : xxx
    }

    //acceleration of orientation
    deviceMotion.orientAcc = {
        pitch : xxx,
        raw : xxx,
        yaw : xxx
    }
0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago