-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathRelativity.pde
More file actions
42 lines (32 loc) · 906 Bytes
/
Relativity.pde
File metadata and controls
42 lines (32 loc) · 906 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
35
36
/**
* Relativity.
*
* Each color is perceived in relation to other colors. The top and bottom
* bars each contain the same component colors, but a different display order
* causes individual colors to appear differently.
*/
color a, b, c, d, e;
void setup() {
size(640, 360);
noStroke();
a = color(165, 167, 20);
b = color(77, 86, 59);
c = color(42, 106, 105);
d = color(165, 89, 20);
e = color(146, 150, 127);
noLoop(); // Draw only one time
}
void draw() {
drawBand(a, b, c, d, e, 0, width/128);
drawBand(c, a, d, b, e, height/2, width/128);
}
void drawBand(color v, color w, color x, color y, color z, int ypos, int barWidth) {
int num = 5;
color[] colorOrder = { v, w, x, y, z };
for(int i = 0; i < width; i += barWidth*num) {
for(int j = 0; j < num; j++) {
fill(colorOrder[j]);
rect(i+j*barWidth, ypos, barWidth, height/2);
}
}
}