===== фрактал окружностей
void setup() {
size(400,400);
smooth();
}
void draw() {
background(255);
stroke(0);
noFill();
drawCircle(width/2,height/2,200);
}
void drawCircle(float x, float y, float radius)
{
ellipse(x, y, radius, radius);
if(radius > 8) {
drawCircle(x+radius/2, y, radius/2);
drawCircle(x-radius/2, y, radius/2);
drawCircle(x, y + radius/2, radius/2);
drawCircle(x, y-radius/2, radius/2);
}
}
=============================================================
void setup() {
size(400,400);
smooth();
}
void draw() {
background(255);
stroke(0);
noFill();
drawRect(0.2*width,0.2*height,0.6*width,0.6*height);}
void drawRect(float x, float y, float dx,float dy )
{rect(x, y, dx, dy);
if(dx>8) {
drawRect(x-dx/4,y-dy/4,dx/2,dy/2);
drawRect(x+dx-dx/4,y+dy-dy/4,dx/2,dy/2);
drawRect(x+dx-dx/4,y-dy/4,dx/2,dy/2);
drawRect(x-dx/4,y+dy-dy/4,dx/2,dy/2); }}
void setup() {
size(400,400);
smooth();
}
void draw() {
background(255);
stroke(0);
noFill();
drawCircle(width/2,height/2,200);
}
void drawCircle(float x, float y, float radius)
{
ellipse(x, y, radius, radius);
if(radius > 8) {
drawCircle(x+radius/2, y, radius/2);
drawCircle(x-radius/2, y, radius/2);
drawCircle(x, y + radius/2, radius/2);
drawCircle(x, y-radius/2, radius/2);
}
}
=============================================================
void setup() {
size(400,400);
smooth();
}
void draw() {
background(255);
stroke(0);
noFill();
drawRect(0.2*width,0.2*height,0.6*width,0.6*height);}
void drawRect(float x, float y, float dx,float dy )
{rect(x, y, dx, dy);
if(dx>8) {
drawRect(x-dx/4,y-dy/4,dx/2,dy/2);
drawRect(x+dx-dx/4,y+dy-dy/4,dx/2,dy/2);
drawRect(x+dx-dx/4,y-dy/4,dx/2,dy/2);
drawRect(x-dx/4,y+dy-dy/4,dx/2,dy/2); }}
Комментариев нет:
Отправить комментарий