-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWalker.java
More file actions
executable file
·281 lines (255 loc) · 7.14 KB
/
Copy pathWalker.java
File metadata and controls
executable file
·281 lines (255 loc) · 7.14 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Walker extends JPanel {
public Walker(Color backColor) {
setBackground(backColor);
}
public void paintComponent(Graphics myGraphics) {
super.paintComponent(myGraphics);
layer(
myGraphics,
/* input */ 5000,
/* color */ Color.red,
/* special color? */ true,
/* special color type */ "cycle",
/* blob size */ 75000,
/* motion type */ "random",
/* shape */ "fillSquares",
/* size scale */ .03,
/* randomizer */ 100,
/* circle limiter? */ true,
/* stuffOutside? */ true,
/* circle radius */ 200,
/* white */ true,
/* blue */ false,
/* cyan */ false,
/* magenta */ false,
/* orange */ false,
/* pink */ false,
/* yellow */ true,
/* green */ false,
/* marsala */ false,
/* radiandOrchid */ false,
/* emerald */ false,
/* tangerineTango */ false,
/* honeysucle */ false,
/* turquoise */ false,
/* mimosa */ false,
/* blueIzis */ false,
/* chiliPepper */ false,
/* sandDollar */ false,
/* blueTurquoise */ false,
/* tigerlily */ false,
/* aquaSky */ false,
/* trueRed */ false,
/* fuchsiaRose */ false,
/* ceruleanBlue */ false,
/* earthGreen */ false,
/* earthBlue */ false);
layer(
myGraphics,
/* input */ 100000,
/* color */ Color.red,
/* special color? */ true,
/* special color type */ "cycle",
/* blob size */ 75000,
/* motion type */ "random",
/* shape */ "fillCircles",
/* size scale */ .7,
/* randomizer */ 10,
/* circle limiter? */ true,
/* stuffOutside? */ false,
/* circle radius */ 200,
/* red */ false,
/* blue */ false,
/* cyan */ false,
/* magenta */ false,
/* orange */ false,
/* pink */ false,
/* yellow */ false,
/* green */ false,
/* marsala */ false,
/* radiandOrchid */ false,
/* emerald */ false,
/* tangerineTango */ false,
/* honeysucle */ false,
/* turquoise */ false,
/* mimosa */ false,
/* blueIzis */ false,
/* chiliPepper */ false,
/* sandDollar */ false,
/* blueTurquoise */ false,
/* tigerlily */ false,
/* aquaSky */ false,
/* trueRed */ false,
/* fuchsiaRose */ false,
/* ceruleanBlue */ false,
/* earthGreen */ true,
/* earthBlue */ true);
}
public void layer(
Graphics g,
int inpuT,
Color coloR,
boolean specialcoloR,
String typE,
int blobsizE,
String motioN,
String shapE,
double sizescalE,
int randomizeR,
boolean circlelimiteR,
boolean outsidE,
int circleradiuS,
boolean b1s,
boolean b2s,
boolean b3s,
boolean b4s,
boolean b5s,
boolean b6s,
boolean b7s,
boolean b8s,
boolean b9s,
boolean b11s,
boolean b10s,
boolean b12s,
boolean b13s,
boolean b14s,
boolean b15s,
boolean b16s,
boolean b17s,
boolean b18s,
boolean b19s,
boolean b20s,
boolean b21s,
boolean b22s,
boolean b23s,
boolean b24s,
boolean b25s,
boolean b26s
)
{
ColorObject[] colorBank = {
new ColorObject(Color.white, b1s, "white"),
new ColorObject(Color.blue, b2s, "blue"),
new ColorObject(Color.cyan, b3s, "cyan"),
new ColorObject(Color.magenta, b4s, "magenta"),
new ColorObject(Color.orange, b5s, "orange"),
new ColorObject(Color.pink, b6s, "pink"),
new ColorObject(Color.yellow, b7s, "yellow"),
new ColorObject(Color.green, b8s, "green"),
new ColorObject(new Color(149, 82, 81), b9s, "marsala"),
new ColorObject(new Color(181, 101, 167), b10s, "radiandOrchid"),
new ColorObject(new Color(0, 155, 119), b11s, "emerald"),
new ColorObject(new Color(221, 65, 36), b12s, "tangerineTango"),
new ColorObject(new Color(214, 80, 118), b13s, "honeysucle"),
new ColorObject(new Color(68, 184, 172), b14s, "turquoise"),
new ColorObject(new Color(239, 192, 80), b15s, "mimosa"),
new ColorObject(new Color(91, 94, 166), b16s, "blueIzis"),
new ColorObject(new Color(155, 35, 53), b17s, "chiliPepper"),
new ColorObject(new Color(223, 207, 190), b18s, "sandDollar"),
new ColorObject(new Color(85, 180, 176), b19s, "blueTurquoise"),
new ColorObject(new Color(225, 93, 68), b20s, "tigerlily"),
new ColorObject(new Color(127, 205, 205), b21s, "aquaSky"),
new ColorObject(new Color(188, 36, 60), b22s, "trueRed"),
new ColorObject(new Color(195, 68, 122), b23s, "fuchsiaRose"),
new ColorObject(new Color(152, 180, 212), b24s, "ceruleanBlue"),
new ColorObject(new Color(11, 138, 0), b25s, "earthGreen"),
new ColorObject(new Color(0, 21, 170), b26s, "earthBlue")
};
Color[] cA = ColorObject.selectColors(colorBank);
Random gen = new Random();
int xI = getWidth() / 2, xF = getWidth() / 2;
int yI = getHeight() / 2, yF = getHeight() / 2;
int input = inpuT;
Color c = coloR;
boolean specialColor = specialcoloR;
String type = typE; // bAndW, random, cycle
int blobSize = blobsizE;
String motion = motioN;
String shape = shapE; // lines, fillCircles, openCircles, fillSquares, openSquares, 90s
double sizeScale = sizescalE;
int randomizer = randomizeR; // usually 10
boolean circleLimiter = circlelimiteR;
boolean outside = outsidE;
int circleRadius = circleradiuS;
for (int z = 0; z < input; z++) {
xI = xF;
yI = yF;
if (specialColor) {
if (type.equals("bAndW")) {
int i = gen.nextInt(256);
c = new Color(i, i, i);
}
if (type.equals("random")) {
c = new Color(gen.nextInt(256), gen.nextInt(256), gen.nextInt(256));
}
if (type.equals("cycle")) {
int cycleTracker = (z / blobSize % cA.length);
c = cA[cycleTracker];
}
}
g.setColor(c);
if (motion.equals("random")) {
xF = xI + gen.nextInt(randomizer * 2 + 1) - randomizer;
yF = yI + gen.nextInt(randomizer * 2 + 1) - randomizer;
}
if (motion.equals("90s")) {
if (z % 2 == 0) {
xF = xI + gen.nextInt(randomizer * 2 + 1) - randomizer;
} else {
yF = yI + gen.nextInt(randomizer * 2 + 1) - randomizer;
}
}
if (xF > getWidth()) {
xF = xF - getWidth();
continue;
}
if (xF < 0) {
xF = xF + getWidth();
continue;
}
if (yF > getHeight()) {
yF = yF - getHeight();
continue;
}
if (yF < 0) {
yF = yF + getHeight();
continue;
}
if (circleLimiter) {
if (outside) {
if (Math.sqrt((xF - getWidth() / 2) * (xF - getWidth() / 2)
+ (yF - getHeight() / 2) * (yF - getHeight() / 2)) < circleRadius) {
continue;
}
} else {
if (Math.sqrt((xF - getWidth() / 2) * (xF - getWidth() / 2)
+ (yF - getHeight() / 2) * (yF - getHeight() / 2)) > circleRadius) {
continue;
}
}
}
if (shape.equals("lines")) {
g.drawLine(xI, yI, xF, yF);
}
if (shape.equals("openCircles")) {
int r = (int) ((xF - xI) * sizeScale);
g.drawOval(xI, yI, r, r);
}
if (shape.equals("fillCircles")) {
int r = (int) ((xF - xI) * sizeScale);
g.fillOval(xI, yI, r, r);
}
if (shape.equals("openSquares")) {
int r = (int) ((xF - xI) * sizeScale);
g.drawRect(xI, yI, r, r);
}
if (shape.equals("fillSquares")) {
int r = (int) ((xF - xI) * sizeScale);
g.fillRect(xI, yI, r, r);
}
}
}
}