Skip to content

Commit e43549b

Browse files
committed
2 parents d55b835 + 2bd7842 commit e43549b

File tree

9 files changed

+64
-16
lines changed

9 files changed

+64
-16
lines changed

app/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ body {
22
background-color: #000000;
33
width: 100%;
44
height: 100%;
5+
cursor: none;
56
}
67

78
.mainTable {
@@ -34,6 +35,10 @@ table {
3435

3536
}
3637

38+
#sbs {
39+
visibility: hidden;
40+
}
41+
3742
#visitor-caps{
3843
width:600px;
3944
text-align: center;

app/thumbSelect_revise.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var thumbnail = inheritFrom(HTMLElement, function() {
1616

1717
_this.reset = () => {
1818
_this.className = '';
19-
_this.thumb.src = _this.setName.replace('-', '/') + '/thumb.jpg';
19+
_this.thumb.src = _this.setName.replace('-', '/') + '/thumb.jpg?'+Math.random();
2020
};
2121

2222
_this.onmousedown = () => {
@@ -34,8 +34,15 @@ var thumbnail = inheritFrom(HTMLElement, function() {
3434
thumbClick();
3535
_this.className = 'thumbSelect';
3636
_this.player.loadSet(_this.setName.replace('-', '/') + '/');
37+
setTimeout(()=>{
38+
_this.player.play();
39+
},2000)
3740
}
3841
};
42+
43+
_this.refreshSet = function() {
44+
_this.thumb.src = _this.setName.replace('-', '/') + '/thumb.jpg?'+Math.random();
45+
}
3946
};
4047

4148
this.attributeChangedCallback = function(attr, oldVal, newVal) {
@@ -97,6 +104,7 @@ window.setGroup = function(flp, parent, rws, clm, asTable) {
97104
if (µ('[setName=' + setName + ']') && µ('[setName=' + setName + ']').length) {
98105
var set = µ('[setName=' + setName + ']')[0];
99106
set.setAttribute('setName', setName);
107+
set.refreshSet();
100108
if (parent.childNodes.length > 1) {
101109
var temp = parent.removeChild(set);
102110
parent.insertBefore(temp, parent.firstChild);
@@ -107,7 +115,7 @@ window.setGroup = function(flp, parent, rws, clm, asTable) {
107115
var newSet = document.createElement('thumb-nail');//new setPointer(setName,flipPlr);
108116
newSet.setAttribute('setName', setName);
109117
newSet.setPlayer(flipPlr);
110-
118+
//newSet.refreshSet();
111119
//if(!visitorMode) newSet.setCelebMode(this);
112120
var curNum = sets.length;
113121
sets.push(newSet);

assets/audio/click.mp3

48.2 KB
Binary file not shown.

assets/audio/go.mp3

34.6 KB
Binary file not shown.

assets/audio/one.mp3

34.6 KB
Binary file not shown.

assets/audio/three.mp3

31.9 KB
Binary file not shown.

assets/audio/two.mp3

33.6 KB
Binary file not shown.

index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ <h1>Hello World!</h1>
1212
and Electron <script>document.write(process.versions.electron)</script>.
1313
<audio id='beep' src='assets/audio/beep.mp3'></audio>
1414
<audio id='longBeep' src='assets/audio/long_beep.mp3'></audio>
15-
<!-- <audio id='audio_1' src='assets/audio/beep.mp3'></audio>
16-
<audio id='audio_2' src='assets/audio/beep.mp3'></audio>
17-
<audio id='audio_3' src='assets/audio/beep.mp3'></audio>
18-
<audio id='audio_4' src='assets/audio/long_beep.mp3'></audio> -->
15+
<audio id='click' src='assets/audio/click.mp3'></audio>
16+
<audio id='audio_3' src='assets/audio/three.mp3'></audio>
17+
<audio id='audio_2' src='assets/audio/two.mp3'></audio>
18+
<audio id='audio_1' src='assets/audio/one.mp3'></audio>
19+
<audio id='audio_0' src='assets/audio/go.mp3'></audio>
1920
</body>
2021

2122
<script>

vieworks.js

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,21 @@ beep.load();
3030
let longBeep = document.querySelector('#longBeep');
3131
longBeep.load();
3232

33+
let clickTrack = document.querySelector('#click');
34+
clickTrack.load();
35+
36+
let audio = [];
37+
38+
for (var i = 0; i < 4; i++) {
39+
audio.push(document.querySelector('#audio_' + (i)));
40+
audio[i].load();
41+
}
42+
3343

3444
let idleTO = null;
3545

3646
let resetIdleTimeout = () => {
47+
console.log()
3748
if (idleTO) clearTimeout(idleTO);
3849
idleTO = setTimeout(()=> {
3950
alternateVideo();
@@ -63,6 +74,7 @@ var showGo = () => {
6374

6475
var alternateVideo = () => {
6576
arduino.digitalWrite(6, 0);
77+
console.log("alternate");
6678
setTimeout(() => {
6779
arduino.digitalWrite(6, 1);
6880
}, 100);
@@ -141,34 +153,46 @@ var pollLight = new function(){
141153
var countdown = (count) => {
142154
pollLight.setStage(count);
143155
if (count > 0) {
144-
if(!beep.paused){
156+
/*if(audio[i+1]&&!audio[i+1].paused){
145157
beep.pause();
146158
beep.currentTime = 0;
147-
}
148-
if(count<4) beep.play();
159+
}*/
160+
if(count<4) audio[count].play();
149161
setTimeout(() => { countdown(count - 1); }, 1000);
162+
if(count == 1 ) cam.capture();
150163
} else {
151-
longBeep.play();
164+
//longBeep.play();
165+
audio[count].play();
166+
clickTrack.play();
167+
//audio[count].onended = function () {
168+
//longBeep.play();
169+
//}
152170
pollLight.blink();
153-
cam.capture();
171+
//longBeep.play();
172+
//cam.capture();
154173
console.log('start capture');
155174

156175
setTimeout(function() {
176+
//beep.play();
157177
pollLight.stopBlink();
158178
pollLight.setRed();
159179
cam.stopCapture();
160180
console.log('done capturing');
161181
var dir = './app/sequences/temp' + dirNum++;
182+
if(dirNum>=21) dirNum = 0;
162183
greenExitLight(1);
163184
redExitLight(0);
164185
if (!fs.existsSync(dir)) {
165186
fs.mkdirSync(dir);
166187
save(dir);
188+
fs.utimesSync(dir,NaN,NaN);
167189
} else {
190+
168191
var exec = require('child_process').exec;
169192
exec('rm -r'+dir, ()=>{
170193
//fs.mkdirSync(dir);
171194
save(dir);
195+
fs.utimesSync(dir,NaN, NaN);
172196
});
173197
}
174198

@@ -191,7 +215,7 @@ arduino.connect(cfg.portName, function() {
191215
cam.ready = false;
192216
countdown(5);
193217
greenExitLight(0);
194-
redExitLight(1);
218+
redExitLight(0);
195219
greenEntranceLight( 0);
196220
redEntranceLight( 1);
197221
}
@@ -245,7 +269,7 @@ arduino.connect(cfg.portName, function() {
245269
cam.setFrameRate(200);
246270
cam.setImageGain(6);
247271

248-
cam.allocateBuffer(600);
272+
cam.allocateBuffer(800);
249273

250274
cam.start();
251275
cam.ready = true;
@@ -257,8 +281,11 @@ var dirNum = 0;
257281
function readDir(path) {
258282
var files = fs.readdirSync(path);
259283

260-
files.sort(function(b, a) {
261-
return fs.statSync('./' + path + a).mtime.getTime() - fs.statSync('./' + path + b).mtime.getTime();
284+
files.sort(function(a, b) {
285+
//console.log("Create time for " + a+" is " + fs.statSync('./' + path + a).atime.getTime());
286+
//console.log("Create time for " + b +" is " + fs.statSync('./' + path + b).atime.getTime());
287+
288+
return fs.statSync('./' + path + a).atime.getTime() - fs.statSync('./' + path + b).atime.getTime();
262289
});
263290

264291
for (var i = 0; i < files.length; i++) {
@@ -297,7 +324,7 @@ function onOpen() {
297324
var celFiles = readDir('app/celeb_seq/');
298325
if (webSock) {
299326
for (var i = 0; i < files.length; i++) {
300-
console.log(files[i]);
327+
//console.log(files[i]);
301328
webSock.send('seq=' + files[i].substring(4));
302329
}
303330

@@ -306,3 +333,10 @@ function onOpen() {
306333
}
307334
}
308335
}
336+
337+
document.onkeypress = (e) => {
338+
var press = String.fromCharCode(e.keyCode);
339+
if(press = 'g') {
340+
showGo();
341+
}
342+
}

0 commit comments

Comments
 (0)