-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanel.pde
More file actions
82 lines (71 loc) · 1.26 KB
/
Panel.pde
File metadata and controls
82 lines (71 loc) · 1.26 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Sequencer seq;
float bpm = 128;
float b = 0;
float smooth = .1;
float b0, b1, b2, b3;
void setup() {
fullScreen();
colorMode(HSB);
frameRate(60);
rectMode(CENTER);
b0 = 0;
b1 = 0;
b2 = 0;
b3 = 0;
seq = new Sequencer(bpm, 4, 4, 4, "nigga");
}
void draw() {
background(0);
translate(width / 2, height / 2);
fill(0, 255, b0);
rect(-width / 4, -height / 4, width / 2, height / 2);
fill(75, 255, b1);
rect(width / 4, -height / 4, width / 2, height / 2);
fill(150, 255, b2);
rect(-width / 4, height / 4, width / 2, height / 2);
fill(225, 255, b3);
rect(width / 4, height / 4, width / 2, height / 2);
seq.update();
bg();
}
void keyPressed() {
seq.control();
switch(key) {
case 't':
b0 = 255;
break;
case 'y':
b1 = 255;
break;
case 'g':
b2 = 255;
break;
case 'h':
b3 = 255;
break;
}
}
void mousePressed() {
seq.mouseSelect();
}
void bg() {
b0 = lerp(b0, 0, smooth);
b1 = lerp(b1, 0, smooth);
b2 = lerp(b2, 0, smooth);
b3 = lerp(b3, 0, smooth);
if (seq.outAndChanged(0)) {
b0 = 255;
}
if (seq.outAndChanged(1)) {
b1 = 255;
}
if (seq.outAndChanged(2)) {
b2 = 255;
}
if (seq.outAndChanged(3)) {
b3 = 255;
}
}
void nigga() {
seq.metro.metroTrigger();
}