forked from google/codeu_coding_assessment_2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorwheel.java
More file actions
78 lines (73 loc) · 2.07 KB
/
Colorwheel.java
File metadata and controls
78 lines (73 loc) · 2.07 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
import java.awt.*;
import java.util.*;
public class Colorwheel {
public static void main(String[] args) {
DrawingPanel panel= new DrawingPanel(1000,1000);
Graphics g= panel.getGraphics();
int one= 255;
int two=0;
int three=0;
g.setColor(Color.BLACK);
g.fillOval(200, 300, 20,20);
g.fillOval(400,300,20,20);
g.fillOval(300,350,50,20);
g.drawLine(60,300,100,340);
g.drawLine(100,350,200,350);
g.drawLine(60,400,200,360);
for (int radius=1; radius<=1000; radius++) {
for (int angle=0; angle<60; angle++) { // r to y
g.setColor(new Color(one, two, three));
g.fillArc(50, 100, 500/radius, 500/radius, 100-(60/40)*angle,60/40);
two+=255/60;
}
for (int angle=0; angle<60; angle++) { //y to g
two=235;
g.setColor(new Color(one, two, three));
g.fillArc(50, 100, 500/radius, 500/radius, 40-(60/40)*angle,60/40);
one-=255/60;
}
for (int angle=0; angle<60; angle++) { //g to c
one=0;
two=235;
g.setColor(new Color(one, two, three));
g.fillArc(50, 100, 500/radius, 500/radius, -20-(60/40)*angle,60/40);
three+=255/60;
}
one=0;
two=236;
three=245;
for (int angle=0; angle<60; angle++) { //c to b
g.setColor(new Color(one, two, three));
g.fillArc(50, 100, 500/radius, 500/radius, -80-(60/40)*angle,60/40);
two-=236/60;
three+=15/60;
}
one=0;
three=245;
for (int angle=0; angle<60; angle++) { //b to p
g.setColor(new Color(one, two, three));
g.fillArc(50, 100, 500/radius, 500/radius, -140-(60/40)*angle,60/40);
one+=255/60;
}
three=255;
for (int angle=0; angle<60; angle++) { //p to r
g.setColor(new Color(one, two, three));
g.fillArc(50, 100, 500/radius, 500/radius, -200-(60/40)*angle,60/40);
three-=255/60;
}
}
}
}
//one=0;
//for (int i=1; i<=1000; i++) {
//for (int j=1; j<=3; j++) {
// g.fillArc(50, 100, 500, 500, 120*j,10*i);
//}
//}
/*for (int angle=0; angle<60; angle++) { //y to g
one=0;
two=0;
g.setColor(new Color(one, two, three));
g.fillArc(500, 500, 500, 500, 40-(60/40)*angle,60/40);
two+=255/60;
} */