forked from APCSLowell/OriginalDesign
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOriginalDesign.pde
More file actions
108 lines (106 loc) · 1.68 KB
/
OriginalDesign.pde
File metadata and controls
108 lines (106 loc) · 1.68 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
boolean inArea = false;
int factor = 0;
int ax, bx = 1280/2;
int ay, by = 960/2;
int hell = 0;
int ran1 = 0;
int ran2 = 0;
double sz = 1e6;
void setup()
{
size(1280,960);
background(0);
colorMode(HSB,360);
}
void draw()
{
fill(0,0,0,36);
stroke(0,0,0,36);
rect(0,0,1280,960);
stroke(0,0,180,360);
initColorBox();
noFill();
stroke(3*hell,360,180);
translate(bx,by);
rotate(factor*PI/60);
ran1 = (int)(-Math.log(Math.random())*Math.log(sz));
ran2 = (int)(-Math.log(Math.random())*Math.log(sz));
line(-960/8, 0, 960/8, 0);
line(0, -960/8, 0, 960/8);
ellipse(0,0,ran1,ran2);
}
void keyPressed() {
if (key == CODED) {
switch (keyCode)
{
case UP :
{factor++;
break;
}
case DOWN :
{factor--;
break;
}
/* case LEFT :
{hell--;
hell%=120;
while(hell<0)
{hell+=120;}
break;
}
case RIGHT :
{hell++;
hell%=120;
while(hell<0)
{hell+=120;}
break;
}*/
}
}
else switch (key) {
case 'z' :
{
sz/=10;
break;
}
case 'x' :
{
sz*=10;
break;
}
}
}
void mouseDragged() {
if(!inArea) {
bx = mouseX;
by = mouseY;
}
}
void mousePressed() {
if(inArea){
if (mouseButton == LEFT) {
hell = ay;
fill(0,0,360);
textSize(64);
translate(-bx,-by);
text(hell,0,960/8);
translate(bx,by);
}
else if (mouseButton == RIGHT) {
}
}
}
void mouseMoved() {
ax = mouseX;
ay = mouseY;
if( ax<=1280/8 && ax>=0 && ay<=960/8 && ay>=0 )
{inArea = true;}
else
{inArea = false;}
}
void initColorBox() {
rect(0,0,1280/8,960/8);
fill(0,0,360);
textSize(12);
text("Click box to change color",0,960/16);
}