Push dev work to master #2
|
@ -255,169 +255,7 @@
|
|||
<img id="mscriptIcon" onclick="mscriptPage();" class="icon" src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjMycHgiIGhlaWdodD0iMzJweCIgdmlld0JveD0iMCAwIDUyMi40NjggNTIyLjQ2OSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTIyLjQ2OCA1MjIuNDY5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPGc+CgkJPHBhdGggZD0iTTMyNS43NjIsNzAuNTEzbC0xNy43MDYtNC44NTRjLTIuMjc5LTAuNzYtNC41MjQtMC41MjEtNi43MDcsMC43MTVjLTIuMTksMS4yMzctMy42NjksMy4wOTQtNC40MjksNS41NjhMMTkwLjQyNiw0NDAuNTMgICAgYy0wLjc2LDIuNDc1LTAuNTIyLDQuODA5LDAuNzE1LDYuOTk1YzEuMjM3LDIuMTksMy4wOSwzLjY2NSw1LjU2OCw0LjQyNWwxNy43MDEsNC44NTZjMi4yODQsMC43NjYsNC41MjEsMC41MjYsNi43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LTIuODUxLDQuMDktMi44NTEsNi41NjdzMC45NDgsNC42NjUsMi44NTEsNi41NjdsMTEyLjIwNiwxMTIuMjA0TDM1OS4xNjMsMzczLjQ0MiAgICBjLTEuOTAyLDEuOTAyLTIuODUxLDQuMDkzLTIuODUxLDYuNTYzYzAsMi40NzgsMC45NDgsNC42NjgsMi44NTEsNi41N2wxNC4yNzEsMTQuMjY4YzEuOTA5LDEuOTA2LDQuMDkzLDIuODU0LDYuNTcsMi44NTQgICAgYzIuNDcxLDAsNC42NjEtMC45NTEsNi41NjMtMi44NTRMNTE5LjYxNCwyNjcuOGMxLjkwMy0xLjkwMiwyLjg1NC00LjA5NiwyLjg1NC02LjU3ICAgIEM1MjIuNDY4LDI1OC43NTUsNTIxLjUxNywyNTYuNTY1LDUxOS42MTQsMjU0LjY2M3oiIGZpbGw9IiNGRkZGRkYiLz4KCTwvZz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K" />
|
||||
</div>
|
||||
</footer>
|
||||
<script>
|
||||
'use strict';
|
||||
const BOLEX = {
|
||||
angle : 133,
|
||||
prism : 0.8,
|
||||
expected : 630
|
||||
};
|
||||
const STATE = {
|
||||
dir : true,
|
||||
exposure : 630, //always ms
|
||||
delay : 0,
|
||||
scale : 'ms',
|
||||
delayScale : 'ms',
|
||||
counter : 0
|
||||
}
|
||||
//functions
|
||||
let frame;
|
||||
let getState;
|
||||
let setDir;
|
||||
let setExposure;
|
||||
let setDelay;
|
||||
let setCounter;
|
||||
//ms
|
||||
var shutter = function (exposure) {
|
||||
let fraction = BOLEX.expected / 1000;
|
||||
let speed;
|
||||
let corrected;
|
||||
let str;
|
||||
if (exposure > BOLEX.expected) {
|
||||
//if exposure is explicitly set
|
||||
fraction = exposure / 1000;
|
||||
speed = fraction;
|
||||
} else {
|
||||
speed = fraction * (BOLEX.angle / 360);
|
||||
}
|
||||
corrected = speed * BOLEX.prism;
|
||||
if (corrected < 1.0) {
|
||||
//less than a second
|
||||
str = '1/' + Math.round(Math.pow(corrected, -1)) + ' sec';
|
||||
} else if (corrected >= 1.0 && corrected < 60) {
|
||||
//greater than a second, less than a minute
|
||||
str = '' + (Math.round(corrected * 10) / 10) + ' sec'
|
||||
} else if (corrected >= 60 && corrected < 60 * 60) {
|
||||
//greater than a minute, less than an hour
|
||||
str = '' + (Math.round(corrected / 6) / 10) + ' min';
|
||||
} else if (corrected >= 60 * 60 && corrected < 60 * 60 * 24) {
|
||||
//greater than an hour, less than a day
|
||||
str = '' + (Math.round(corrected / (6 * 60)) / 10) + ' hr';
|
||||
} else if (corrected >= 60 * 60 * 24) {
|
||||
//greater than a day
|
||||
str = '' + (Math.round(corrected / (6 * 60 * 24)) / 10) + ' day';
|
||||
}
|
||||
return { speed : speed, str : str }
|
||||
};
|
||||
|
||||
var scaleAuto = function (ms) {
|
||||
if (ms < 1000) {
|
||||
return 'ms'
|
||||
} else if (ms >= 1000 && ms < 1000 * 60) {
|
||||
return 'sec'
|
||||
} else if (ms >= 1000 * 60 && ms < 1000 * 60 * 60) {
|
||||
return 'min'
|
||||
} else if (ms >= 1000 * 60 * 60) {
|
||||
return 'hour'
|
||||
}
|
||||
};
|
||||
|
||||
var scaleTime = function (raw, scale) {
|
||||
if (scale === 'ms') {
|
||||
return raw
|
||||
} else if (scale === 'sec') {
|
||||
return raw * 1000;
|
||||
} else if (scale === 'min') {
|
||||
return raw * (1000 * 60);
|
||||
} else if (scale === 'hour') {
|
||||
return raw * (1000 * 60 * 60);
|
||||
}
|
||||
};
|
||||
|
||||
var setExposureScale = function () {
|
||||
const scale = document.getElementById('scale').value;
|
||||
const elem = document.getElementById('exposure');
|
||||
if (scale === 'ms') {
|
||||
elem.value = STATE.exposure;
|
||||
} else if (scale === 'sec') {
|
||||
elem.value = STATE.exposure / 1000;
|
||||
} else if (scale === 'min') {
|
||||
elem.value = STATE.exposure / (1000 * 60);
|
||||
} else if (scale === 'hour') {
|
||||
elem.value = STATE.exposure / (1000 * 60 * 60);
|
||||
}
|
||||
STATE.scale = scale;
|
||||
};
|
||||
|
||||
var setDelayScale = function () {
|
||||
const scale = document.getElementById('scale').value;
|
||||
const elem = document.getElementById('delay');
|
||||
if (scale === 'ms') {
|
||||
elem.value = STATE.delay;
|
||||
} else if (scale === 'sec') {
|
||||
elem.value = STATE.delay / 1000;
|
||||
} else if (scale === 'min') {
|
||||
elem.value = STATE.delay / (1000 * 60);
|
||||
} else if (scale === 'hour') {
|
||||
elem.value = STATE.delay / (1000 * 60 * 60);
|
||||
}
|
||||
STATE.delayScale = scale;
|
||||
};
|
||||
|
||||
var setDirLabel = function (dir) {
|
||||
const bwdLabel = document.getElementById('bwdLabel');
|
||||
const fwdLabel = document.getElementById('fwdLabel');
|
||||
if (dir) {
|
||||
bwdLabel.classList.remove('selected')
|
||||
fwdLabel.classList.add('selected')
|
||||
} else {
|
||||
fwdLabel.classList.remove('selected')
|
||||
bwdLabel.classList.add('selected')
|
||||
}
|
||||
};
|
||||
var incCounter = function (val) {
|
||||
const elem = document.getElementById('counter');
|
||||
const current = elem.value;
|
||||
elem.value = (parseInt(current) + val);
|
||||
STATE.counter += val;
|
||||
};
|
||||
var forceCounter = function (val) {
|
||||
document.getElementById('counter').value = val;
|
||||
}
|
||||
var unsetPages = function () {
|
||||
const pages = document.getElementsByClassName('page');
|
||||
const icons = document.getElementsByClassName('icon');
|
||||
for (let icon of icons) {
|
||||
if (icon.classList.contains('selected')) icon.classList.remove('selected');
|
||||
}
|
||||
for (let page of pages){
|
||||
if (page.classList.contains('selected')) page.classList.remove('selected');
|
||||
}
|
||||
};
|
||||
var appPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('app').classList.add('selected');
|
||||
document.getElementById('appIcon').classList.add('selected');
|
||||
};
|
||||
var settingsPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('settings').classList.add('selected');
|
||||
document.getElementById('settingsIcon').classList.add('selected');
|
||||
};
|
||||
var sequencerPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('sequencer').classList.add('selected');
|
||||
document.getElementById('sequencerIcon').classList.add('selected');
|
||||
};
|
||||
var mscriptPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('mscript').classList.add('selected');
|
||||
document.getElementById('mscriptIcon').classList.add('selected');
|
||||
};
|
||||
var isNumeric = function (n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
}
|
||||
</script>
|
||||
<script src="static/js/intval.core.js"></script>
|
||||
<script>
|
||||
'use strict'
|
||||
const web = {};
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
'use strict';
|
||||
const BOLEX = {
|
||||
angle : 133,
|
||||
prism : 0.8,
|
||||
expected : 630
|
||||
};
|
||||
const STATE = {
|
||||
dir : true,
|
||||
exposure : 630, //always ms
|
||||
delay : 0,
|
||||
scale : 'ms',
|
||||
delayScale : 'ms',
|
||||
counter : 0
|
||||
}
|
||||
//functions
|
||||
let frame;
|
||||
let getState;
|
||||
let setDir;
|
||||
let setExposure;
|
||||
let setDelay;
|
||||
let setCounter;
|
||||
//ms
|
||||
var shutter = function (exposure) {
|
||||
let fraction = BOLEX.expected / 1000;
|
||||
let speed;
|
||||
let corrected;
|
||||
let str;
|
||||
if (exposure > BOLEX.expected) {
|
||||
//if exposure is explicitly set
|
||||
fraction = exposure / 1000;
|
||||
speed = fraction;
|
||||
} else {
|
||||
speed = fraction * (BOLEX.angle / 360);
|
||||
}
|
||||
corrected = speed * BOLEX.prism;
|
||||
if (corrected < 1.0) {
|
||||
//less than a second
|
||||
str = '1/' + Math.round(Math.pow(corrected, -1)) + ' sec';
|
||||
} else if (corrected >= 1.0 && corrected < 60) {
|
||||
//greater than a second, less than a minute
|
||||
str = '' + (Math.round(corrected * 10) / 10) + ' sec'
|
||||
} else if (corrected >= 60 && corrected < 60 * 60) {
|
||||
//greater than a minute, less than an hour
|
||||
str = '' + (Math.round(corrected / 6) / 10) + ' min';
|
||||
} else if (corrected >= 60 * 60 && corrected < 60 * 60 * 24) {
|
||||
//greater than an hour, less than a day
|
||||
str = '' + (Math.round(corrected / (6 * 60)) / 10) + ' hr';
|
||||
} else if (corrected >= 60 * 60 * 24) {
|
||||
//greater than a day
|
||||
str = '' + (Math.round(corrected / (6 * 60 * 24)) / 10) + ' day';
|
||||
}
|
||||
return { speed : speed, str : str }
|
||||
};
|
||||
|
||||
var scaleAuto = function (ms) {
|
||||
if (ms < 1000) {
|
||||
return 'ms'
|
||||
} else if (ms >= 1000 && ms < 1000 * 60) {
|
||||
return 'sec'
|
||||
} else if (ms >= 1000 * 60 && ms < 1000 * 60 * 60) {
|
||||
return 'min'
|
||||
} else if (ms >= 1000 * 60 * 60) {
|
||||
return 'hour'
|
||||
}
|
||||
};
|
||||
|
||||
var scaleTime = function (raw, scale) {
|
||||
if (scale === 'ms') {
|
||||
return raw
|
||||
} else if (scale === 'sec') {
|
||||
return raw * 1000;
|
||||
} else if (scale === 'min') {
|
||||
return raw * (1000 * 60);
|
||||
} else if (scale === 'hour') {
|
||||
return raw * (1000 * 60 * 60);
|
||||
}
|
||||
};
|
||||
|
||||
var setExposureScale = function () {
|
||||
const scale = document.getElementById('scale').value;
|
||||
const elem = document.getElementById('exposure');
|
||||
if (scale === 'ms') {
|
||||
elem.value = STATE.exposure;
|
||||
} else if (scale === 'sec') {
|
||||
elem.value = STATE.exposure / 1000;
|
||||
} else if (scale === 'min') {
|
||||
elem.value = STATE.exposure / (1000 * 60);
|
||||
} else if (scale === 'hour') {
|
||||
elem.value = STATE.exposure / (1000 * 60 * 60);
|
||||
}
|
||||
STATE.scale = scale;
|
||||
};
|
||||
|
||||
var setDelayScale = function () {
|
||||
const scale = document.getElementById('scale').value;
|
||||
const elem = document.getElementById('delay');
|
||||
if (scale === 'ms') {
|
||||
elem.value = STATE.delay;
|
||||
} else if (scale === 'sec') {
|
||||
elem.value = STATE.delay / 1000;
|
||||
} else if (scale === 'min') {
|
||||
elem.value = STATE.delay / (1000 * 60);
|
||||
} else if (scale === 'hour') {
|
||||
elem.value = STATE.delay / (1000 * 60 * 60);
|
||||
}
|
||||
STATE.delayScale = scale;
|
||||
};
|
||||
|
||||
var setDirLabel = function (dir) {
|
||||
const bwdLabel = document.getElementById('bwdLabel');
|
||||
const fwdLabel = document.getElementById('fwdLabel');
|
||||
if (dir) {
|
||||
bwdLabel.classList.remove('selected')
|
||||
fwdLabel.classList.add('selected')
|
||||
} else {
|
||||
fwdLabel.classList.remove('selected')
|
||||
bwdLabel.classList.add('selected')
|
||||
}
|
||||
};
|
||||
var incCounter = function (val) {
|
||||
const elem = document.getElementById('counter');
|
||||
const current = elem.value;
|
||||
elem.value = (parseInt(current) + val);
|
||||
STATE.counter += val;
|
||||
};
|
||||
var forceCounter = function (val) {
|
||||
document.getElementById('counter').value = val;
|
||||
}
|
||||
var unsetPages = function () {
|
||||
const pages = document.getElementsByClassName('page');
|
||||
const icons = document.getElementsByClassName('icon');
|
||||
for (let icon of icons) {
|
||||
if (icon.classList.contains('selected')) icon.classList.remove('selected');
|
||||
}
|
||||
for (let page of pages){;
|
||||
if (page.classList.contains('selected')) page.classList.remove('selected');
|
||||
}
|
||||
};
|
||||
var appPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('app').classList.add('selected');
|
||||
document.getElementById('appIcon').classList.add('selected');
|
||||
};
|
||||
var settingsPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('settings').classList.add('selected');
|
||||
document.getElementById('settingsIcon').classList.add('selected');
|
||||
};
|
||||
var sequencerPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('sequencer').classList.add('selected');
|
||||
document.getElementById('sequencerIcon').classList.add('selected');
|
||||
};
|
||||
var mscriptPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('mscript').classList.add('selected');
|
||||
document.getElementById('mscriptIcon').classList.add('selected');
|
||||
};
|
||||
var isNumeric = function (n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
};
|
|
@ -23,6 +23,6 @@ server {
|
|||
#gzip_comp_level 5;
|
||||
#gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
|
||||
#use project location
|
||||
alias /home/pi/intval3/static/;
|
||||
alias /home/pi/intval3/www/static/;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue