想辦法均勻散佈中...
程式碼:
void setup(){size(800,600);background(255,255,255);smooth();noLoop();}
void draw(){ for(int j=0;j<100;j++){ translate(random(-50,100),random(-50,100));fill(random(150,255),random(150,255),random(150,255),255);ellipse(-35, -5, 70, 10);for(int i=0;i<180;i++){ rotate(-PI/10);fill(random(150,255),random(150,255),random(150,255),255);ellipse(-35, -5, 70, 10);}fill(random(150,255),random(150,255),random(150,255),255);ellipse(0, 0, 60, 60);} }
void draw(){ for(int j=0;j<100;j++){ translate(random(-50,100),random(-50,100));fill(random(150,255),random(150,255),random(150,255),255);ellipse(-35, -5, 70, 10);for(int i=0;i<180;i++){ rotate(-PI/10);fill(random(150,255),random(150,255),random(150,255),255);ellipse(-35, -5, 70, 10);}fill(random(150,255),random(150,255),random(150,255),255);ellipse(0, 0, 60, 60);} }
-----------------------------------------
void setup() {size(800, 600);
}void draw() { } // Empty draw() keeps the program runningvoid mousePressed() {float xx=random(0,100),yy=random(0,20);translate(mouseX,mouseY);fill(random(150,255),random(150,255),random(150,255),255);ellipse(-xx/2, -yy/2, xx, yy);for(int i=0;i<180;i++){ rotate(-PI/10);fill(random(150,255),random(150,255),random(150,255),255);ellipse(-xx/2, -yy/2, xx, yy);}fill(random(150,255),random(150,255),random(150,255),255);ellipse(0, 0, xx, xx);
}
}void draw() { } // Empty draw() keeps the program runningvoid mousePressed() {float xx=random(0,100),yy=random(0,20);translate(mouseX,mouseY);fill(random(150,255),random(150,255),random(150,255),255);ellipse(-xx/2, -yy/2, xx, yy);for(int i=0;i<180;i++){ rotate(-PI/10);fill(random(150,255),random(150,255),random(150,255),255);ellipse(-xx/2, -yy/2, xx, yy);}fill(random(150,255),random(150,255),random(150,255),255);ellipse(0, 0, xx, xx);
}
沒有留言:
張貼留言