Many small updates, added gyronym logic

master
Keith Irwin 2018-08-30 02:54:55 +00:00
parent d18dbcef88
commit 98cba6ad7e
28 changed files with 30 additions and 18 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
LICENSE.md Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

5
gyronorm.complete.min.js vendored Normal file

File diff suppressed because one or more lines are too long

0
icons/apple-touch-icon-114x114.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

0
icons/apple-touch-icon-120x120.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

0
icons/apple-touch-icon-144x144.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
icons/apple-touch-icon-152x152.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
icons/apple-touch-icon-57x57.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

0
icons/apple-touch-icon-60x60.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

0
icons/apple-touch-icon-72x72.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

0
icons/apple-touch-icon-76x76.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

0
icons/favicon-128.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

0
icons/favicon-16x16.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 693 B

0
icons/favicon-196x196.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

0
icons/favicon-32x32.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
icons/favicon-96x96.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

0
icons/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

0
icons/mstile-144x144.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
icons/mstile-150x150.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

0
icons/mstile-310x150.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

0
icons/mstile-310x310.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 125 KiB

0
icons/mstile-70x70.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

1
index.html Normal file → Executable file
View File

@ -69,6 +69,7 @@
<div id='by'>by <a href="https://keithirwin.us/">Keith Irwin</a></div>
</footer>
<script src="gyronorm.complete.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="script.js"></script>

0
manifest.webmanifest → manifest.json Normal file → Executable file
View File

0
rose.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

42
script.js Normal file → Executable file
View File

@ -1,5 +1,5 @@
'use strict';
/* global navigator $ */
/* global navigator $ GyroNorm */
// Set units based on browser locale
const metric = !(window.navigator.language=='en-US'||window.navigator.language=='my');
@ -39,23 +39,29 @@ else { navigator.geolocation.watchPosition(
}
// Set compass orientation
function setRose(e) {
var gn = new GyroNorm()
gn.init().then(function(){
gn.start(function(data){
// No orientation data
if(!e.absolute) {
$('#rotated').hide();
$('#no-dir').show();
}
// Set orientation
else {
var rot = 'rotate('+e.alpha.toString().substring(0,5)+'deg)';
$('#rose').css({
'-ms-transform': rot,
'-webkit-transform': rot,
'transform': rot
});
}
// No orientation data
if (!data.do.absolute) {
$('#rotated').hide();
$('#no-dir').show();
}
// Set orientation
else {
const rot = 'rotate('+data.do.alpha.toString().substring(0,5)+'deg)';
$('#rose').css({
'-ms-transform': rot,
'-webkit-transform': rot,
'transform': rot
})
}
})
})
}
window.addEventListener("deviceorientation", setRose, true);

0
style.css Normal file → Executable file
View File