2016年9月26日 星期一

WEEK4

期中作品:射擊小遊戲
組員:曹家豪

no Fill();    ///no Fill();  不填滿
    ellipse(200,200,40,40);     ///畫圓(x , y, 長 , 寬);
    fill(0); ellipse(200,200,8,8);    ///fill(0); 填滿



複製 x軸上的圓

void setup(){
  size (400,400);
}
void draw(){
  float a=5*frameCount/180.0*3.1415;
  background(255);
  for(int x=0;x<600;x+=40){
    noFill();ellipse(x,200,40,40);
    fill(0);ellipse(x+20*cos(a),200+20*sin(a),8,8);
  }
}



複製 y軸上的圓

void setup(){
  size (400,400);
}
void draw(){
  float a=5*frameCount/180.0*3.1415;
  background(255);
  for(int x=0;x<600;x+=40){
    for(int y=0;y<=600;y+=40){
      noFill();ellipse(x,y,40,40);
      fill(0);ellipse(x+20*cos(a),y+20*sin(a),8,8);
    } 
  }
}



float a=5*(frameCount+x/5+y/5)/180.0*3.1415;  ///右下速度較快,左上速度較慢

void setup(){
  size (400,400);
}
void draw(){
  background(255);
  for(int x=0;x<600;x+=40){
    for(int y=0;y<=600;y+=40){
      float a=5*(frameCount+x/5+y/5)/180.0*3.1415;
      noFill();ellipse(x,y,40,40);
      fill(0);ellipse(x+20*cos(a),y+20*sin(a),8,8);
    } 
  }
}



void setup(){
  size (500,500);
  frameRate(60);
}
void draw(){
  background(255);
  for(int i=0;i<11;i++){
    for(int j=0;j<=11;j++){
      float t=(frameCount/6.0+i+j)*0.7189;
      fill(0,0,0,0);
      ellipse(i*51.5+5, j*51.5+5, 45, 45);
      ellipse(i*51.5+30.5, j*51.5+5, 45, 45);
      ellipse(i*51.5+5, j*51.5+30.5, 45, 45);
      ellipse(i*51.5+30.5, j*51.5+30.5, 45, 45);
      fill(0);
      ellipse(i*51.5+5+22.5*cos(t), j*51.5+5+22.5*sin(t), 5, 5);
      ellipse(i*51.5+30.5+22.5*cos(t), j*51.5+5+22.5*sin(t), 5, 5);
      ellipse(i*51.5+5+22.5*cos(t), j*51.5+30.5+22.5*sin(t), 5, 5);
      ellipse(i*51.5+30.5+22.5*cos(t), j*51.5+30.5+22.5*sin(t), 5, 5);
    } 
  }
}
void keyPressed(){
   if(key==' ')frameRate(1);
}


~~~放影片檔~~~~
1.下載mp4檔--->丟到資料裡面
2.安裝video資料庫
程式碼

import processing.video.*;
SoundFile file;
Movie movie;
void setup(){
  size(500,500);
  //file = new SoundFile(this,"PPAP.mp3");
  //file.play();
 
  movie = new Movie(this,"PPAP.mp4");
  movie.play();
}
void draw(){
  image(movie,0,0,800,450);
}
void movieEvent(Movie m){
  m.read();
}

沒有留言:

張貼留言