-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.pde
More file actions
37 lines (28 loc) · 808 Bytes
/
Copy pathpattern.pde
File metadata and controls
37 lines (28 loc) · 808 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
37
color[] colours = { #f7a85d, #f7f45d, #f75d60, #d8f75d, #8cf75d, #f7c95d, #5df7ef, #5db2f7, #5df7a3, #895df7, #d65df7, #5d7ff7};
boolean isVertical = true;
float totalBars;
void initPattern() {
totalBars = width / magnification;
}
void drawPattern() {
for (int i = 0; i < totalBars; i = i + 1) {
int colourIndex = (i % (colours.length * accuracy)) / accuracy;
color c = colours[colourIndex];
noStroke();
fill(c);
if (isVertical) {
rect(magnification * i, 0, magnification, height);
continue;
}
rect(0, magnification * i, width, magnification);
}
}
void changeOrientation() {
if (key == ' ') {
if (isVertical) {
isVertical = false;
return;
}
isVertical = true;
}
}