2013年9月15日 星期日

Week02

1.初戰for迴圈

void setup(){
  size(600,400);
}

void draw(){
  for(int x=0;x<600; x+=100){
    for(int y=0;y<400; y+=100){
      rect(x,y,100,100);
    }
  }
}
2.初戰變形顏色

void setup(){
  background(255,250,168);
  size(600,400);
}

void draw(){
  for(int x=0;x<600; x+=100){
    for(int y=0;y<400; y+=100){
      quad(x,y, 86, 20, 69, 63, 30, 76);
    }
  }
}
3.變形顏色再開

void setup(){
  background(255,250,168);
  size(600,400);
}

void draw(){
  for(int x=0;x<600; x+=100){
    for(int y=0;y<400; y+=100){
      fill(243,157,114,200);
      rect(x,y,100,60);
      
      fill(255,0,0,100);
      quad(x,y, 50, 60, 10, 10, 10, 0);
    }
  }
}
4.初戰滑鼠變化

void setup(){
  background(255,250,168);
  size(600,400);
}

void draw(){
  for(int x=0;x<600; x+=100){
    for(int y=0;y<400; y+=100){
      fill(243,157,114,dist(x,y,mouseX,mouseY));
      rect(x,y,100,60);
      
      fill(255,0,0,dist(x,y,mouseX,mouseY));
      quad(x,y, 50, 60, 10, 10, 10, 0);
    }
  }
}

5.初戰random顏色

color [][] myColor = new color[6][4];
void setup(){
  background(255,250,168);
  size(600,400);
  for(int x=0;x<600;x+=100){
    for(int y=0;y<400;y+=100){
      myColor[x/100][y/100] = color(random(256),random(256),random(256));
}
 }
}
void draw(){
  for(int x=0;x<600; x+=100){
    for(int y=0;y<400; y+=100){
      fill(myColor[x/100][y/100],dist(x,y,mouseX,mouseY));
      rect(x,y,100,60);
      
      fill(myColor[x/100][y/100],dist(x,y,mouseX,mouseY));
      quad(x,y, 50, 60, 10, 10, 10, 0);
    }
  }
}
6.心得初戰
比其他程式語言簡單很多 學的也比較有就感 但有時候老師進度跟講話速度太快 一不小心就沒聽到 希望老師有時候能放慢一點







沒有留言:

張貼留言