Wednesday, June 30, 2010
Psychedelic Circles
// 1: draw the outer circle
// 2: draw n-1 concentric circles
int randRed, randGreen, randBlue;
//int randSeed = int(50);
void setup(){
size(800, 500);
noFill();
//frameRate(60);
//noLoop();
}
void draw(){
//background(255);
drawConcentricCircles(400, 250, 1500, 10);
}
void drawOneCircle( int x, int y, int r){
smooth();
noStroke();
if(random(1)<0.5) {
fill(0);
} else {
fill(255);
}
ellipse(x, y, r, r);
}
void drawConcentricCircles(int x, int y, int r, int steps){
if(r > steps + 1){
drawOneCircle(x,y,r);
drawConcentricCircles(x,y, r-steps, steps);
}
}
// 2: draw n-1 concentric circles
int randRed, randGreen, randBlue;
//int randSeed = int(50);
void setup(){
size(800, 500);
noFill();
//frameRate(60);
//noLoop();
}
void draw(){
//background(255);
drawConcentricCircles(400, 250, 1500, 10);
}
void drawOneCircle( int x, int y, int r){
smooth();
noStroke();
if(random(1)<0.5) {
fill(0);
} else {
fill(255);
}
ellipse(x, y, r, r);
}
void drawConcentricCircles(int x, int y, int r, int steps){
if(r > steps + 1){
drawOneCircle(x,y,r);
drawConcentricCircles(x,y, r-steps, steps);
}
}
comments

Add a comment: