2020年5月7日 星期四

week_11 さよならの朝に約束の花をかざろう

1.文字表現相關函式
2.畫5*5的圓,有一顆顏色會比較深

懶人

void setup(){
  size(300,500);
  colormode
}
int circle=5,R=300/circle,r=0;
int ansX=int(random(circle) ),ansY=int (random(circle));
void draw(){
 
  background(#0041FF);
  
  for(int x=0;x<circle;x++){
     for(int y=0;y<circle;y++){
        ellipse(R/2+x*R,200+R/2+y*R , R,R);
        if(x==ansX && y==ansY){
          fill(#00FF0E, 150);
        }  
        else
           fill(#00FF0E);
     }
  }
}

void mousePressed(){
    ansX=int(random(circle) );
    ansY=int (random(circle));
    
}


沒有留言:

張貼留言