Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Key Bindings Frontend, added Partices-js for better look (looks good ?).
Browse files Browse the repository at this point in the history
  • Loading branch information
localleon committed May 10, 2018
1 parent a3859d4 commit cd8175a
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 12 deletions.
41 changes: 36 additions & 5 deletions go/static/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ html{
padding: 0px;
background-color: var(--light-black);
color:white;
overflow:hidden;

}

h1{
Expand All @@ -20,22 +22,30 @@ h2{
}

.header{
width: 100%;
position: absolute;
z-index: 5;
letter-spacing: 5px;
float: clear;
color: var(--light-blue);
}

.logo{
padding: 25px 20px 0px 0px ;
float: left;
width: 100px;
height: auto;
}

.header-h1{
padding: 10px 0px 0px 100px;
}


.inner{
margin-top: 8%;
position: absolute;
z-index: 5;
margin-left: 20px;
display: inline-grid;
grid-template-columns: 50% 50% 50%;
Expand Down Expand Up @@ -72,11 +82,32 @@ h2{

.lcdread{
padding: 5px;
font-size: 1.4em;
margin-top: 20px;
width: 350px;
height: 130px;
border: 2px black solid;
width: 400px;
height: 80px;;
background-color: white;
}


.lcdtext{
margin: 0px;
padding: 5px;
color: black;
}
font-size: 1.5em;
}
#lcdsecond{
margin-left: 8px;
}

#btnrefresh{
margin-top:20px;
}

#aa_particles
{
z-index: 4;

height: 100%;
height: 100vh;

}
17 changes: 10 additions & 7 deletions go/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="index.css">
<script src="index.js"></script>
<script src="particle-min.js"></script>
<title>Barco-SLM-Network</title>
</head>

<body>
<div class="header">
<img src="favicon.ico" class="logo" alt="Logo of the Project">
<img src="logo-trans.png" class="logo" alt="Logo of the Project">
<h1 class="header-h1">Barco-SLM-Network</h1>
</div>

Expand Down Expand Up @@ -101,15 +102,17 @@ <h2>Standby</h2>

<h2>LCD-Display</h2>
<div class="lcdread">
<p id="lcdfirst"></p>
<p id="lcdsecond"></p>
<p class="lcdtext" id="lcdfirst">LCD not loaded</p>
<p class="lcdtext" id="lcdsecond">LCD not loaded</p>
</div>
<button class="btn" onclick="readLCD()">Refresh</button>
<button class="btn" id="btnrefresh" onclick="readLCD()">Refresh</button>
</div>
<div>
<p>// Developed by Thomas "Moesby" Neteler and Leon Rauschenbach</p>
<p>// Link to the Dokumentation</p>
</div>



</div>
<div id="aa_particles"></div>

</body>

Expand Down
139 changes: 139 additions & 0 deletions go/static/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
window.onload = function () {
console.log('App started')
window.addEventListener('keydown', this.keybindings, false)
readLCD()
this.setInterval(readLCD, 2500)
particlejsinit()
}

function apirequest(cmd, opt) {
Expand Down Expand Up @@ -36,4 +38,141 @@ function parseLCD(json) {
var lcdsecond = document.getElementById("lcdsecond")
lcdfirst.innerHTML = json.First
lcdsecond.innerHTML = json.Second
}

function keybindings(e) {
// Bind Apirequests to Keys
var key = e.keyCode;
switch (key) {
case 37:
apirequest('infrared', 'arrowleft');
break; //Left key
case 38:
apirequest('infrared', 'arrowup');
break; //Up key
case 39:
apirequest('infrared', 'arrowright');
break; //Right key
case 40:
apirequest('infrared', 'arrowdown');
break; //Down key
case 79:
apirequest('shutteropen', 'fast');
break; // o key
case 67:
apirequest('shutterclose', 'fast');
break; // c key
case 13:
apirequest('infrared', 'enter');
break; // enter key
case 27:
apirequest('infrared', 'exit');
break; //esc key
default:
//alert(key); //Everything else
}
}

function particlejsinit() {
console.log("Loaded particles-js")
/* ---- particles.js config ---- */

particlesJS("aa_particles", {
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 5
},
},
"opacity": {
"value": 0.5,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 3,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 150,
"color": "#ffffff",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 2,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": true,
"mode": "grab"
},
"resize": true
},
"modes": {
"grab": {
"distance": 140,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200,
"duration": 0.4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
});
}
Binary file added go/static/logo-trans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions go/static/particle-min.js

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions go/static/particlesjs-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 5
},
"image": {
"src": "img/github.svg",
"width": 100,
"height": 100
}
},
"opacity": {
"value": 0.5,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 2,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 200,
"color": "#ffffff",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 6,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": true,
"mode": "grab"
},
"onclick": {
"enable": true,
"mode": "push"
},
"resize": true
},
"modes": {
"grab": {
"distance": 400,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200,
"duration": 0.4
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
}
Binary file added logo/logo-trans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd8175a

Please sign in to comment.