-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlattice.pde
103 lines (89 loc) · 1.87 KB
/
lattice.pde
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Declaring some classes // Need to be capitalized
Colorwheel c;
Linetool l;
Dottool d;
Gridtool g;
// Colorwheel Variables
float primarySat = constrain(100,1,100);
float primaryBright = constrain(50,1,100);
float primaryHue = constrain(180,0,360);
float complimentaryHue = 360;
// Variables
char mode = 'd';
boolean mouse = false;
float penStrokeWeight = 5;
char input;
int maxSize = 20;
int margin = 80;
void setup() {
// Objects
c = new Colorwheel();
l = new Linetool();
d = new Dottool();
g = new Gridtool();
// Defining Color Mode and size
colorMode(HSB, 360, 100, 100);
size(560, 560);
background(primaryHue,100,100);
}
void draw() {
if(mouse == true) {
if(mode == 'd') {
d.dotTool();
} else if(mode == 'l') {
l.lineTool();
}
}
}
void mousePressed() {
mouse = true;
}
void mouseReleased() {
mouse = false;
}
void keyPressed() {
char keyboard = key;
switch(keyboard) {
// Turn on lines
case 'l':
case 'L':
mode = 'l';
break;
case 'k':
case 'K':
mode = 'd';
break;
// Making stroke weight smaller
case '[':
penStrokeWeight = constrain(penStrokeWeight - 1, 0, maxSize);
break;
// Making stroke weight bigger
case ']':
penStrokeWeight = constrain(penStrokeWeight+1, 0, maxSize);
break;
// Increasing grid
case '\'':
maxSize = constrain(maxSize*2,10,80);
break;
// Decreasing grid
case ';':
maxSize = constrain(maxSize/2,10,80);
break;
// Hue Shifting the Background
case 'h':
case 'H':
primaryHue = c.hueShift(primaryHue);
background(primaryHue,100,100);
break;
case 'q':
g.makeGrid();
default:
mouse = false;
break;
}
}
void keyReleased() {
if (key == 'q') {
g.killGrid();
}
}