【Processing】四角形でフラクタル を動かす

 

float b = 0;

void setup(){
size(500,500);
background(255);
}


void draw(){
background(255);
noStroke();
rectMode(CENTER);
drawRect(width/2,height/2,b);
b+=5;
}

void drawRect(float x,float y, float hi){
float wi = hi/3;
fill(map(hi,width*5,0,255,0),90);
rect(x,y,wi,hi);
if(hi>5){
  translate(x,y);
  rotate(radians(b/1000));
  drawRect(0,0,hi/1.2);
}
}

 

今日は疲れたから少しだけ