期未報告:
小鋼琴
按鍵節奏遊戲
1.律動
void setup(){
size(500,500);
frameRate(60);
}
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);
}
}
}
2.播放影片
先載 video 跟 sound插件
import processing.sound.*;
import processing.video.*;
SoundFile file;
Movie movie;
void setup(){
size(640,360);
//file=new SoundFile(this,"PPP.mp3");
//file.play();
movie=new Movie(this, "PPP.mp4");
movie.play();
}
void draw(){
image(movie, 0,0,640,360);
}
void movieEvent(Movie m){
m.read();
}
3.加一個事件
按鍵


沒有留言:
張貼留言