generated from uwcc/vizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
music_starter.js
executable file
·43 lines (35 loc) · 1.21 KB
/
music_starter.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
// vocal, drum, bass, and other are volumes ranging from 0 to 100
function draw_one_frame(words, vocal, drum, bass, other, counter) {
background(20)
textFont('Helvetica'); // please use CSS safe fonts
rectMode(CENTER)
textSize(24);
let bar_spacing = height / 10;
let bar_height = width / 12;
let bar_pos_x = width / 2;
// vocal bar is red
fill(200, 0, 0);
rect(bar_pos_x, height / 2 + 1 * bar_spacing, 4 * vocal, bar_height);
fill(0);
text("vocals", bar_pos_x, height / 2 + 1 * bar_spacing + 8);
// drum bar is green
fill(0, 200, 0);
rect(bar_pos_x, height / 2 + 2 * bar_spacing, 4 * drum, bar_height);
fill(0);
text("drums", bar_pos_x, height / 2 + 2 * bar_spacing + 8);
// bass bar is blue
fill(50, 50, 240);
rect(bar_pos_x, height / 2 + 3 * bar_spacing, 4 * bass, bar_height);
fill(0);
text("bass", bar_pos_x, height / 2 + 3 * bar_spacing + 8);
// other bar is white
fill(200, 200, 200);
rect(bar_pos_x, height / 2 + 4 * bar_spacing, 4 * other, bar_height);
fill(0);
text("other", bar_pos_x, height / 2 + 4 * bar_spacing + 8);
fill(255, 255, 0);
// display "words"
textAlign(CENTER);
textSize(vocal);
text(words, width/2, height/3);
}