Skip to content

Commit e43f1db

Browse files
authored
Formatting
1 parent d9489e7 commit e43f1db

File tree

1 file changed

+54
-53
lines changed

1 file changed

+54
-53
lines changed

midiKnobControl_colors.html

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
max = parseInt(min) + parseInt(degRange);
253253
valRange = maxVal- minVal;
254254
rosetta = degRange / valRange;
255-
startingValue = node.getAttribute("value");
255+
startingValue = node.getAttribute("value");
256256

257257

258258
var parent = node.parentNode;
@@ -267,49 +267,49 @@
267267
rotate(face, min);
268268

269269

270-
var label = document.createElement("label");
271-
label.className = "knobInput-label";
272-
var progress = document.createElement("canvas");
273-
274-
progress.className = "knob-progress";
275-
label.innerHTML = node.value;
276-
knob.setAttribute("data-original-element", node.id);
277-
knob.setAttribute("data-rosetta", rosetta);
278-
knob.setAttribute("min", minVal);
279-
var hand = document.createElement(tagBase + "-hand");
280-
281-
knob.appendChild(face);
282-
knob.appendChild(progress);
283-
knob.appendChild(label);
284-
face.appendChild(hand);
285-
knob.appendChild(node);
270+
var label = document.createElement("label");
271+
label.className = "knobInput-label";
272+
var progress = document.createElement("canvas");
273+
274+
progress.className = "knob-progress";
275+
label.innerHTML = node.value;
276+
knob.setAttribute("data-original-element", node.id);
277+
knob.setAttribute("data-rosetta", rosetta);
278+
knob.setAttribute("min", minVal);
279+
var hand = document.createElement(tagBase + "-hand");
280+
281+
knob.appendChild(face);
282+
knob.appendChild(progress);
283+
knob.appendChild(label);
284+
face.appendChild(hand);
285+
knob.appendChild(node);
286286

287287

288-
if(sibling){
289-
parent.insertBefore(knob, sibling)
290-
} else{
291-
parent.appendChild(knob);
292-
}
288+
if(sibling){
289+
parent.insertBefore(knob, sibling)
290+
} else{
291+
parent.appendChild(knob);
292+
}
293293

294294

295-
if(startingValue){
296-
var degrees = (startingValue - minVal) * rosetta;
297-
degrees = parseInt(degrees) + parseInt(min);
298-
rotate(face, degrees);
295+
if(startingValue){
296+
var degrees = (startingValue - minVal) * rosetta;
297+
degrees = parseInt(degrees) + parseInt(min);
298+
rotate(face, degrees);
299299

300-
var rad = parseInt(getCSS(face, "width"))/ 2;
300+
var rad = parseInt(getCSS(face, "width"))/ 2;
301301

302302
}
303303

304304

305-
knob.addEventListener("mousedown", function(e){
306-
focused = this;
307-
mouse.clickPos = e.pageY;
308-
mouse.lastPos = e.pageY;
309-
document.body.className += "noSelection";
305+
knob.addEventListener("mousedown", function(e){
306+
focused = this;
307+
mouse.clickPos = e.pageY;
308+
mouse.lastPos = e.pageY;
309+
document.body.className += "noSelection";
310310
});
311311

312-
document.addEventListener("mousemove", function(e){
312+
document.addEventListener("mousemove", function(e){
313313
if(focused){
314314
if(!mouse.lastPos){
315315
mouse.lastPos = mouse.clickPos;
@@ -386,12 +386,12 @@
386386

387387
}
388388

389-
function clearCanvas(canvas){
389+
function clearCanvas(canvas){
390390
var ctx = canvas.getContext("2d");
391391
ctx.clearRect ( 0 , 0 , canvas.width, canvas.height );
392392
}
393393

394-
function drawArc(canvas, radius, deg, min, lw, col){
394+
function drawArc(canvas, radius, deg, min, lw, col){
395395
//console.log(canvas, radius, deg, min, lw, col);
396396
var ctx = canvas.getContext("2d");
397397
clearCanvas(canvas);
@@ -402,55 +402,56 @@
402402
ctx.stroke();
403403
}
404404

405-
function simulateEvent(ev, elm) {
405+
function simulateEvent(ev, elm) {
406406
var event = new Event('input', {
407407
'view': window
408408
});
409409
var cb = elm;
410410
cb.dispatchEvent(event);
411411
}
412412

413-
function toRad(deg){
413+
function toRad(deg){
414414
var rad = deg / (180 / Math.PI);
415415
return rad;
416416
}
417417

418418

419-
function rotate(elm, deg){
419+
function rotate(elm, deg){
420420
elm.style.transform = "rotate("+ deg +"deg)";
421421
}
422422

423-
function getCSS(elm, prop){
423+
function getCSS(elm, prop){
424424
return window.getComputedStyle(elm, prop).getPropertyValue(prop);
425425
}
426426

427427

428-
rangeKnob(document.querySelectorAll('.blue'), 20, "#525AD9");
428+
rangeKnob(document.querySelectorAll('.blue'), 20, "#525AD9");
429429

430-
rangeKnob([document.getElementById('pink')], 30, "#D952AC");
430+
rangeKnob([document.getElementById('pink')], 30, "#D952AC");
431431

432432

433433
// nk
434434

435-
function loop(){window.setInterval(updateKnob,100)}
436-
function updateKnob(){
437-
var yop = (document.getElementById('key_data').innerHTML.slice(64,67).replace(']',''))*2.83464
438-
document.getElementById('knob01').value = yop
439-
document.getElementsByClassName('knobInput-face')[0].style.transform = "rotate("+document.getElementById('knob01').value+"deg)"
440-
document.getElementsByClassName('knobInput-label')[0].innerHTML = document.getElementById('knob01').value
441-
document.getElementById('knob01').value = yop
442-
document.getElementsByClassName('knobInput-face')[1].style.transform = "rotate("+yop+"deg)"
443-
document.getElementsByClassName('knobInput-label')[1].innerHTML = yop
435+
function loop(){window.setInterval(updateKnob,100)}
436+
437+
function updateKnob(){
438+
var yop = (document.getElementById('key_data').innerHTML.slice(64,67).replace(']',''))*2.83464
439+
document.getElementById('knob01').value = yop
440+
document.getElementsByClassName('knobInput-face')[0].style.transform = "rotate("+document.getElementById('knob01').value+"deg)"
441+
document.getElementsByClassName('knobInput-label')[0].innerHTML = document.getElementById('knob01').value
442+
document.getElementById('knob01').value = yop
443+
document.getElementsByClassName('knobInput-face')[1].style.transform = "rotate("+yop+"deg)"
444+
document.getElementsByClassName('knobInput-label')[1].innerHTML = yop
444445
}
445446

446-
function randomColor() {
447+
function randomColor() {
447448
return [
448449
Math.floor(Math.random() * 255),
449450
Math.floor(Math.random() * 255),
450451
Math.floor(Math.random() * 255)];
451452
}
452453

453-
function upBck(){
454+
function upBck(){
454455
document.body.style.backgroundColor = 'rgb('+randomColor()+')'
455456
document.getElementsByClassName('button')[0].style.backgroundColor = 'rgb('+randomColor()+')'
456457
document.getElementsByClassName('button')[1].style.backgroundColor = 'rgb('+randomColor()+')'
@@ -461,7 +462,7 @@
461462

462463
// OOooOOO
463464

464-
(function(){
465+
(function(){
465466
var log = console.log.bind(console), keyData = document.getElementById('key_data'),
466467
deviceInfoInputs = document.getElementById('inputs'), deviceInfoOutputs = document.getElementById('outputs'), midi;
467468
var AudioContext = AudioContext || webkitAudioContext; // for ios/safari

0 commit comments

Comments
 (0)