2008年5月13日 星期二

期中考

float angle = 0.0;
void setup() {
size(800, 600);
background(0);
smooth();

}
void draw() {
background(0);
fill(255);
rect(300,500,50,50);
stroke(255,0,0,200);
line(510,550,510,330);
if (mousePressed == true) {
angle = angle + 0.5;
translate(510,330);
rotate(angle);
strokeWeight(15); // Increase stroke weight
for (int i = 0; i < 30; i++) {
strokeWeight(10);
rotate(PI/15);
stroke(0,0,255,200);
line(50, 50, 50,0);
strokeWeight(20);
rotate(PI/30);
stroke(0,255,0,200);
line(20, 20, 40,0);
strokeWeight(20);
rotate(PI/30);
stroke(255,0,0,200);
line(10, 10, 20,0);
}
}
else
{
strokeWeight(15); // Increase stroke weight
translate(510, 330);
for (int i = 0; i < 30; i++) {
strokeWeight(10);
rotate(PI/15);
stroke(0,0,255,200);
line(50, 50, 50,0);
strokeWeight(20);
rotate(PI/30);
stroke(0,255,0,200);
line(20, 20, 40,0);
strokeWeight(20);
rotate(PI/30);
stroke(255,0,0,200);
line(10, 10, 20,0);
}}}

沒有留言: