===== 視訊 ======
http://www.eden.net.nz/7/20071008/
Click here to download the installer for version 1.0.5
of WinVDIG.
可以在 Processing-Examples-Library-video-Capture 看到很多範例
BackgroundSubstruction 這個範例不錯,簡單!
小葉老師最短的視訊
import processing.video.*;
Capture video;
void setup(){
size(640,480,P2D);
video = new Capture(this, width, height);
video.start();
loadPixels();
}
void draw(){
if(video.available()){
video.read();
video.loadPixels();
for(int i=0;i<640*480;i++){
pixels[i]=video.pixels[i];
}
updatePixels();
}
}
=====同時很多按鍵可能不能按======
http://www.mobile01.com/topicdetail.php?f=351&t=1831722&r=7&last=34166864
=====怎麼做唯舞獨尊的四個鍵======
int d1=0,d2=0,d3=0,d4=0;
void setup(){
size(900,400);
}
void draw(){
if(d1==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
rect(100,100,100,100);
if(d2==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
rect(300,100,100,100);
if(d3==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
rect(500,100,100,100);
if(d4==1){
fill(255,0,0);
}else{
fill(128,128,128);
}
rect(700,100,100,100);
}
void keyPressed(){
if(key=='1'){
d1=1;
}else if(key=='2'){
d2=1;
}else if(key=='3'){
d3=1;
}else if(key=='4'){
d4=1;
}
}
void keyReleased(){
if(key=='1'){
d1=0;
}else if(key=='2'){
d2=0;
}else if(key=='3'){
d3=0;
}else if(key=='4'){
d4=0;
}
}
沒有留言:
張貼留言