Skip to content

Gyroscope

Josh Stovall edited this page Dec 19, 2020 · 3 revisions

Gyroscope()

Create a gyroscope listener. See the live demo

// setup gyroscope
new XR.Gyroscope({
     action: listen,
     scale: [-1, 1]
});

// listen function
function listen(e){
     console.log(e);
     // { x: 0, y: 0, z: 0 }
}

Parameters

Name Type Default Description
action function function to call on gyroscope updates
scale array [-1, 1] set min/max axis values
Clone this wiki locally