2015年10月19日 星期一

02161070_胡為傑_02161070

1)做出圓圈圈
void setup(){
  size(500,500);
}
void draw(){
  background(255);
  for(int i=-1;i<20;i++){
    for(int j=-i;j<20;j++){
      float a=500.0/18.0;
      float r=a*2-10;
      float t=((i+j)*4+frameCount)/12.0;
      noFill();
      ellipse(i*a,j*a,r,r);
      fill(0);
      ellipse(i*a+r*cos(t),j*a+r*sin(t),5,5);
    }
  }
}
2)做出計時器的功能
int count=600;
void setup(){
size(500,500);
}
void draw(){
  if(count<60) background(20,50,0,0);
  else{
    background(255);
    count--;
  }
  fill(0,255,255);
  textSize(50);
  text("Time: "+int(count/60),100,100);
}
void mousePressed(){
  count=600;
}

沒有留言:

張貼留言