2016年9月26日 星期一

2016/9/26 Week04

1.畫一堆會轉動的圓

void setup(){
  size(600,600);
}
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);
    }
  }
}



2.多4倍圓

void setup(){
  size(500,500);
}
void draw(){

  background(255);
  for(int x=0;x<11;x++){
    for(int y=0;y<11;y++){
      float a=(frameCount/20.0+x+y)*0.7189;
      noFill();
      ellipse(x*51.5+5,y*51.5+5,45,45);
      ellipse(x*51.5+30.5,y*51.5+5,45,45);
      ellipse(x*51.5+5,y*51.5+30.5,45,45);
      ellipse(x*51.5+30.5,y*51.5+30.5,45,45);
      fill(0);
      ellipse(x*51.5+5+22.5*cos(a),y*51.5+5+22.5*sin(a),5,5);
      ellipse(x*51.5+30.5+22.5*cos(a),y*51.5+5+22.5*sin(a),5,5);
      ellipse(x*51.5+5+22.5*cos(a),y*51.5+30.5+22.5*sin(a),5,5);
      ellipse(x*51.5+30.5+22.5*cos(a),y*51.5+30.5+22.5*sin(a),5,5);
    }
  }
}



3.播放影片

先到=>工具=>添加工具=>Libraries=>Sound|Sound。。。=>Install ///音效
先到=>工具=>添加工具=>Libraries=>Video|Video。。。=>Install///影片

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

沒有留言:

張貼留言