neolsn / cordova-plugin-gyroscope Goto Github PK
View Code? Open in Web Editor NEWCordova Device Gyroscope Plugin
Cordova Device Gyroscope Plugin
After success call back I got different kind of orientation objects and
and I want to check whether the iPhone is in landscape or portrait orientation currently.
success call back is below:
Orientation {x: 0.02584065205703885, y: -0.3507689419159716, z: -0.1126170930161808, timestamp: 1476258447743.268}
I'm trying to get the speed x,y,z positions using this code:
methods: {
startGyroscope: function() {
alert("start Gyroscope")
navigator.gyroscope.getCurrent(this.onSuccess, this.onError);
},
onSuccess (speed) {
alert("success")
this.speed.x = speed.x
this.speed.y = speed.y
this.speed.z = speed.z
this.speed.timestamp = speed.timestamp
},
onError (err) {
alert("code: " + err.code + " message: " + err.message)
}
}
I call the startGyroscope when the page is loaded
Error code 3 with this message "no sensors found to register gyroscope listening to"
Hi, I found the gyro reading in iOS is velocity and not absolute value (I haven't tested on Android so I don't know if it's the same). I did a quick hack to read absolute orientation instead of velocity:
https://gist.github.com/micuat/8382a28f6cc32a4fb2862544c56fb784#file-cdvgyroscope-m-L53
I guess ideally the API can switch between velocity and absolute orientation. Is this something I should make a PR? Otherwise I will create my own plugin...
Hi,
I wanted to knew what is the unity of the vector3 returned by the getCurrent function.
Thanks for that plugin :3
I'm sorry, i'm a beat newb. I'm able to use deviceorientation in html5, but i'm lost with your plugin
It would be kind to provide a code example.
I don't know how to use it and how to have an answer... What kind of object is returned.... Sorry...
Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.