-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
55 lines (38 loc) · 1.06 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
console.clear();
import Vis from './modules/Vis.js';
import Controls from './modules/Controls.js';
// setup
// TODO library setup should be here
const vids = document.querySelectorAll('video');
const vizraVid = {
// get vids() { return document.querySelectorAll('video') },
// 🤷🏻♀️
src: ['library/logos/livejs/ljstitle.mp4', 'library/logos/livejs/ljstitle.mp4'],
vis: new Vis(16),
controls: new Controls(vids),
start: function() {
this.controls.init();
this.vis.start();
console.log(this.src);
vids.forEach((el, i) => {
el.play();
el.src = this.src[i];
});
}
}
// go
// const vis = new Vis(16);
vizraVid.vis.draw = function() {
// console.log("%c"+"mixVal: "+vizraVid.controls.mixVal, 'background:turquoise; border: 2px solid violet; padding: 4px; color: black;');
if (vizraVid.vis.frequencies[2] > vizraVid.controls.mixVal) {
vids[1].style.opacity = 0;
} else {
vids[1].style.opacity = 1;
}
}
// resume/start on user gesture
window.addEventListener("keydown", event => {
if (event.code === 'KeyR') {
vizraVid.start();
}
})