Search the Community
Showing results for tags 'deviceorientation'.
I'm using the `deviceorientation` event to get phone rotation data. And I'm noticing that at least on my device the rotation data is very "jumpy". That is it can look something like this: 0 -10 0 1 2 4 40 20 Have not had a change to try the Gyroscope API but I imagine it has the same limitation. My question is, does any one know of a technique to smooth of the rotation data. So in the above example, it would be `0, 0, 1, 2, 4, 20`. The use case is that when a user rotates the phone to the left/right, the app would apply a force vector. But with jumpy data like the above, the result isn't a smooth experience.
Try it here : http://topheman-playground.herokuapp.com/ I developped a little experiment that could lead to a game. Basically, it's using : NodeJS with socket.io for the real time (plugged on expressjs for the server part/session management) Ball.js (client side) : a little library I wrote that handles the physics of the balls as well as their rendering on the canvas. Once you're connected to the main page with a desktop or a laptop, snap the QR-Code with a mobile device (phone/tablet), you will be able to control your ball by tilting your phone like on a labyrinth game, using your phone like a Wiimote to your desktop screen. This is more an experiment that could lead to a game than a game itself. All the sources are on github under MIT license, so feel free to fork it, give some feedback/ideas. Tophe PS : The demo is hosted on a heroku instance that doesn't support Websocket (so it fallbacks on xhr-polling), this is why you may have a little latency and the ball may take sometime to disconnect. You can install it on your computer if you have node, it's a simple npm install, everything's explained in the readme.
Topheman Bombs takes advantage of the accelerometer (devicemotion/deviceorientation events) on your device.It's using Ball.js, a game engine I made that handles physics interactions between balls as well as rendering. You can play offline, or on your desktop browser via the accelerometer emulator !Tilt your device to manage the blue dotTap the screen to drop bombs on the enemies (red dots)Grab the green dots to get more bombsTest Topheman Bombs here + video demo ...