2016年3月24日 星期四

Week05_02160323_class

今天要做一個眼睛會轉的故事












void setup(){
  size(500,500);
}
void draw(){
  float t= frameCount/180.0*PI;
  background(0);
  fill(255);
  ellipse(150,200,150,150);                        //眼睛(位置,位置,大小,大小);
  ellipse(500-150,200,150,150);
  fill(0,0,200);
  ellipse(150+15*cos(t),200+15*sin(t),50,50);             //眼珠大小位置
  ellipse(500-150+15*cos(t),200+15*sin(t),50,50);
}


--------------------------------------------------------------------------------------------------------------------


void setup(){
  size(500,500);
}
void draw(){
  //float t= frameCount/180.0*PI;
  background(0);
  fill(255);
  ellipse(150,200,150,150);
  ellipse(500-150,200,150,150);
  fill(0,0,200);
  float t=atan2(mouseY-50,mouseX-80);
  ellipse(150+15*cos(t),150+15*sin(t),50,50);
  t=atan2(mouseY-50,mouseX-80);                                                   //可以鬥雞眼
  ellipse(500-150+15*cos(t),150+15*sin(t),50,50);                          //新增讓眼珠可以跟著滑鼠動
}

----------------------------------------------------------------------------------------------------------------------




















void setup(){
  size(500, 500);
}
void draw(){
  //float t = frameCount/180.0*PI;
  background(255);
 float t=frameCount/100.0;
 for (float f=0; f<PI; f+=0.1) {
   fill(50);
   rect(200+150*cos(f+t), f*100, 30, 30);
   rect(200+150*cos(f+t+PI), f*100, 30, 30);                        //做個螺旋的方塊讓她們自由旋轉
  }
}

-------------------------------------------------------------------------------------------------------------------

沒有留言:

張貼留言