-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.pde
More file actions
34 lines (31 loc) · 890 Bytes
/
Copy pathMatrix.pde
File metadata and controls
34 lines (31 loc) · 890 Bytes
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
class Matrix extends Frame {
ArrayList<float[]> matrix = new ArrayList<float[]>();
double size = in.bufferSize();
float space = 25.0f;
int a = 1;
Matrix() {
background(0);
}
void frame() {
background(0);
colorMode(RGB);
float[] arr = new float[(int)size/a];
for (int i = 0; i < size/a - 1; i++) {
arr[i] = in.mix.get(i*a);
}
matrix.add(arr);
if (matrix.size() > height/space) matrix.remove(0);
strokeWeight(10);
for (int row = 0; row < matrix.size(); row++)
for (double x = 0; x < matrix.get(row).length; x++) {
float val = matrix.get(row)[(int)x];
//if (val > 0) {
stroke(0.0, 255.0, 0.0, Math.abs(val)*255);
/*} else {
stroke(255.0, 0.0, 0.0, -val*255);
}*/
point((float)(a*x/size * width), height - (space * row));
}
//println(matrix.size());
}
}