2012年10月15日 星期一

老師的 Mail

cws@mail.mcu.edu.tw

For迴圈(方塊放大)

float g;
float max_distance;
int h = 2 ;


void setup()
{
  size(480,480);
  background(0);
  max_distance = dist(0,0,width,height);
  rectMode(CENTER);
  noStroke();
}


void draw()

{
  background(50);
     for( int i=15 ;  i < width ; i=i+40){
       for( int j=15 ; j < height ; j=j+40){
       g = (dist(mouseX,mouseY,i,j)/max_distance*15)*h ;
       float y = random(0,255);
       float k = random(0,255);
       float l = random(0,255);
         fill(y,k,l);
          rect(i,j,g,g);
           }
         }
  
}


void mousePressed()
{
  h=h*2;
}

2012年10月1日 星期一

球的遊戲


void setup()

{
  size(500,500);
 background(0);
 fill(255);
 ellipse(250,250,25,25);
}


void draw()

{


}