Old SandTable project
This commit is contained in:
@@ -0,0 +1,323 @@
|
||||
:root {
|
||||
font-size: 16px;
|
||||
font-family: 'Open Sans';
|
||||
--text-primary: #b6b6b6;
|
||||
--text-secondary: #ececec;
|
||||
--bg-primary: #121212;
|
||||
--bg-secondary: #222222;
|
||||
}
|
||||
body {
|
||||
background-color: var(--bg-primary);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
}
|
||||
.header{
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
top: 0;
|
||||
height: 8rem;
|
||||
background-color: var(--bg-secondary);
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
color: var(--text-secondary);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.center a {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
|
||||
/* Navigation bar */
|
||||
.nav {
|
||||
width: 100%;
|
||||
height: 8rem;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
background-color: var(--bg-secondary);
|
||||
}
|
||||
ul.nav-list {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-left: -50px;
|
||||
margin-top: 0px;
|
||||
height: 95%;
|
||||
list-style-type: none;
|
||||
align-items: center;
|
||||
}
|
||||
ul.nav-list li {
|
||||
width: 25%;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
ul.nav-list .icon {
|
||||
font-size: 70px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
|
||||
/* Index page */
|
||||
main.index {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 85%;
|
||||
}
|
||||
#canvas-div {
|
||||
visibility: visible;
|
||||
height: 0;
|
||||
padding-bottom: 100%;
|
||||
width: 90%;
|
||||
max-width: 1000px;
|
||||
margin: auto;
|
||||
margin-bottom: 0;
|
||||
margin-top: 8rem;
|
||||
}
|
||||
.track-playing {
|
||||
font-size: 40px;
|
||||
text-align: center;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.track-playing p {
|
||||
margin: 0;
|
||||
}
|
||||
.media {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.media a {
|
||||
width: 33%;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.media .icon {
|
||||
font-size: 70px;
|
||||
}
|
||||
.media #play .icon {
|
||||
font-size: 200px;
|
||||
}
|
||||
.pause {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Tracks page */
|
||||
main.tracks {
|
||||
height: 100%;
|
||||
}
|
||||
.header-list {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.header-list li {
|
||||
text-align: center;
|
||||
}
|
||||
.header-list a {
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
font-size: 50px;
|
||||
}
|
||||
.track-list-div {
|
||||
padding-top: 8rem;
|
||||
padding-bottom: 12rem;
|
||||
}
|
||||
ul.track-list {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 0px;
|
||||
list-style-type: none;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
ul.track-list li {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
width: 50%;
|
||||
}
|
||||
ul.track-list a {
|
||||
margin-left: 15%;
|
||||
margin-right: 15%;
|
||||
}
|
||||
ul.track-list .list-pic {
|
||||
align-self: center;
|
||||
width: 100%;
|
||||
}
|
||||
ul.track-list .track-name {
|
||||
color: var(--text-primary);
|
||||
text-decoration: none;
|
||||
font-size: 30px;
|
||||
}
|
||||
.upload-div {
|
||||
position: fixed;
|
||||
bottom: 10rem;
|
||||
width: 100vw;
|
||||
text-align: center;
|
||||
}
|
||||
.upload-div a {
|
||||
color: var(--text-secondary);
|
||||
background-color: var(--bg-primary);
|
||||
text-decoration: none;
|
||||
font-size: 30px;
|
||||
}
|
||||
.empty {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
||||
/* Upload page */
|
||||
main.upload {
|
||||
color: var(--text-primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
/* Queue page */
|
||||
main.queue {
|
||||
height: 85%;
|
||||
}
|
||||
.queue-list-div {
|
||||
height: 75vh;
|
||||
}
|
||||
.queue-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
list-style-type: decimal;
|
||||
color: var(--text-primary);
|
||||
font-size: 20px;
|
||||
}
|
||||
ul.queue-list li {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
width: 50%;
|
||||
}
|
||||
.queue-list a {
|
||||
margin-left: 30px;
|
||||
color: var(--text-primary);
|
||||
text-decoration: none;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
|
||||
/* Track page */
|
||||
.track-info {
|
||||
margin-top: 8rem;
|
||||
width: 98vw;
|
||||
}
|
||||
.track-info img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
/* Color-picker div */
|
||||
#picker {
|
||||
width: 100%;
|
||||
max-width: 1000px;
|
||||
margin: auto;
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
#picker .IroColorPicker {
|
||||
margin: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
div#rgbw {
|
||||
height: 100vw;
|
||||
|
||||
}
|
||||
div#rgbw ul {
|
||||
padding-inline-start: 0;
|
||||
height: 95%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
list-style-type: none;
|
||||
align-content: space-between;
|
||||
}
|
||||
div#rgbw li {
|
||||
text-align: start;
|
||||
margin: 0;
|
||||
width: 40%;
|
||||
}
|
||||
div#rgbw li.right {
|
||||
text-align: end;
|
||||
padding-inline-end: 5px;
|
||||
}
|
||||
.dot {
|
||||
height: 5rem;
|
||||
width: 5rem;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
font-size: 20px;
|
||||
color: var(--text-primary);
|
||||
text-align: center;
|
||||
}
|
||||
.dot p {
|
||||
font-size: 35px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
.dot.red {
|
||||
background-color: red;
|
||||
}
|
||||
.dot.green {
|
||||
background-color: green;
|
||||
}
|
||||
.dot.blue {
|
||||
background-color: blue;
|
||||
}
|
||||
.dot.white {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
/* Settings page */
|
||||
.settings-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
list-style-type: none;
|
||||
}
|
||||
.settings-list li {
|
||||
margin: 40px 0;
|
||||
text-align: center;
|
||||
}
|
||||
.btn {
|
||||
background-color: var(--bg-primary);
|
||||
color: var(--text-secondary);
|
||||
border-radius: 50%;
|
||||
font-size: 40px;
|
||||
padding: 20px 50px;
|
||||
}
|
||||
.settings-list a {
|
||||
color: var(--text-secondary);
|
||||
font-size: 30px;
|
||||
}
|
||||
#speedSlider {
|
||||
width: 80vw;
|
||||
}
|
||||
#ledSlider {
|
||||
width: 80vw;
|
||||
}
|
||||
#ledIntensitySlider {
|
||||
width: 80vw;
|
||||
}
|
||||
#ledSaturationSlider {
|
||||
width: 80vw;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
@@ -0,0 +1,35 @@
|
||||
var body = document.body;
|
||||
body.style.margin = 0;
|
||||
|
||||
var div = document.getElementById('canvas-div');
|
||||
var canvas = document.getElementById('chart');
|
||||
canvas.height = div.offsetHeight;
|
||||
canvas.width = div.offsetWidth;
|
||||
|
||||
var x_center = div.offsetWidth/2
|
||||
var y_center = div.offsetWidth/2
|
||||
|
||||
var ctx = canvas.getContext("2d");
|
||||
|
||||
// sand background
|
||||
var sand = new Image();
|
||||
sand.src = "static/images/sand.jpg"
|
||||
var pat = ctx.createPattern(sand, "repeat")
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.fillStyle = pat;
|
||||
ctx.arc(x_center, y_center, div.offsetWidth/2-5, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
ctx.strokeStyle = 'white';
|
||||
ctx.lineWidth = 5;
|
||||
ctx.stroke();
|
||||
|
||||
|
||||
|
||||
|
||||
// sand leds
|
||||
var leds = ctx.createRadialGradient(x_center, y_center, 0, x_center, y_center, div.offsetWidth/2+50)
|
||||
leds.addColorStop(0, "rgba(255,0,255,0.1)")
|
||||
leds.addColorStop(1, "rgba(255,0,255,0.3)")
|
||||
ctx.fillStyle = leds;
|
||||
ctx.fill();
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
var div = document.getElementById('picker')
|
||||
var red = document.getElementById('red')
|
||||
var green = document.getElementById('green')
|
||||
var blue = document.getElementById('blue')
|
||||
var white = document.getElementById('white')
|
||||
var red_value = red.innerHTML
|
||||
var green_value = green.innerHTML
|
||||
var blue_value = blue.innerHTML
|
||||
var white_value = white.innerHTML
|
||||
|
||||
var colorPicker = new iro.ColorPicker('#picker', {
|
||||
// Set the size of the color picker
|
||||
width: div.offsetWidth-40,
|
||||
// Set the initial color to pure red
|
||||
color: {r: red_value, g: green_value, b: blue_value},
|
||||
sliderSize: 100,
|
||||
handleRadius: 35,
|
||||
margin: 20,
|
||||
wheelLightness: false
|
||||
});
|
||||
|
||||
|
||||
var whitePicker = new iro.ColorPicker('#picker', {
|
||||
width: div.offsetWidth-40,
|
||||
color: {r: white_value, g: white_value, b: white_value},
|
||||
sliderSize: 100,
|
||||
handleRadius: 35,
|
||||
value: 0,
|
||||
layout: [
|
||||
{
|
||||
component: iro.ui.Slider,
|
||||
options: {
|
||||
sliderType: 'value'
|
||||
}
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
colorPicker.on('input:end', function(color) {
|
||||
// Get RGB values
|
||||
var R = color.rgb['r'];
|
||||
var G = color.rgb['g'];
|
||||
var B = color.rgb['b'];
|
||||
|
||||
// Write value to div
|
||||
red.innerHTML = R;
|
||||
green.innerHTML = G;
|
||||
blue.innerHTML = B;
|
||||
|
||||
// POST values without refreshing
|
||||
const formData = new FormData();
|
||||
formData.append('r', R);
|
||||
formData.append('g', G);
|
||||
formData.append('b', B);
|
||||
formData.append('csrfmiddlewaretoken', '{{ csrf_token }}');
|
||||
console.log(formData);
|
||||
fetch('/color/', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('Success:', data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
whitePicker.on('input:end', function(color) {
|
||||
// Get white value
|
||||
var W = parseInt(color.value * 2.555);
|
||||
|
||||
// Write value to div
|
||||
white.innerHTML = W;
|
||||
|
||||
// POST values without refreshing
|
||||
const formData = new FormData();
|
||||
formData.append('w', W);
|
||||
formData.append('csrfmiddlewaretoken', '{{ csrf_token }}');
|
||||
console.log(formData);
|
||||
fetch('/color/', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('Success:', data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
Vendored
+7
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user