forked from APCSLowell/Scales
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScales.pde
72 lines (65 loc) · 1.71 KB
/
Scales.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
boolean strokebool = false;
void setup() {
size(700, 700);
noLoop();
}
void draw() {
int filling = (int)(Math.random()*3);
if (filling == 2) {
background(255, 255, 100);
} else if (filling== 1) {
background(100, 255, 255);
} else {
background(255, 100, 255);
}
for (int i = 710; i >= -15; i-=(int)(Math.random()*10+10)) {
for (int j = 710; j >= -15; j-=(int)(Math.random()*10+10)) {
scale(i, j, filling);
}
}
}
void scale(int x, int y, int filler) {
int tocolor = (int)(Math.random()*255);
int xSize = (int)(Math.random()*10+30);
int ySize = (int)(Math.random()*5+15);
if (filler == 2) {
if (strokebool) {
stroke(tocolor+20, 255, 120);
}
fill(tocolor, 255, 100);
} else if (filler == 1) {
if (strokebool) {
stroke(130, tocolor+30, 255);
}
fill(100, tocolor, 255);
} else {
if (strokebool) {
stroke(255, 120, tocolor+20);
}
fill(255, 100, tocolor);
}
if (!strokebool){
stroke(0, 0, 0);
}
//ellipse(x-xSize/2, y-ySize/2, xSize+(int)(Math.random()*5), ySize+(int)(Math.random()*5));
int moving = (int)(Math.random()*11);
beginShape();
curveVertex(x-xSize/2-moving, y-ySize/2);
curveVertex(x-xSize/2-moving, y-ySize/2);
curveVertex(x+xSize/2-moving, (y-ySize/2)+(int)(Math.random()*5));
curveVertex(x+xSize/2-moving, (y+ySize/2)-(int)(Math.random()*5));
curveVertex(x-xSize/2-moving, y+ySize/2);
curveVertex(x-xSize/2-moving, y+ySize/2);
endShape();
}
void mousePressed() {
if (mouseButton == RIGHT){
if (strokebool)
stroke(0, 0, 0);
strokebool = !strokebool;
loop();
} else {
noLoop();
}
redraw();
}