Fix cube rotation in Device Orientation API demo #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the Device Orientation API demo, there are a few problems with how the cube on the page rotates, which can make the user think the device orientation API (or your phone sensors) is broken or extremely limited. This PR fixes the issues, making the cube's rotation much more intuitive and better showing off the power of the device orientation API.
This PR fixes these issues. I applied the tips from https://dev.opera.com/articles/w3c-device-orientation-usage/ to correct the cube rotation. It does add a chunk of matrix math code to an otherwise simple demo page implementation, but I think it's really worth it.
Here's a link to the to improved demo so you can try it easily: https://macil.github.io/HTML5-API-demos/demos/device-orientation-api-demo.html
This PR also adds an .editorconfig file to let developers have their indent settings be autoconfigured while working on files in this project, and changes the cube to be less transparent (I found I very often accidentally mixed up the front and back faces of the cube which made it very confusing). These are in different commits to make them easy to drop if you don't want them.