無法觀看請到這裡
https://drive.google.com/file/d/0B7aK8WDuM6-UZl95MHVMSi1fS2s/view?usp=sharing
import de.voidplus.leapmotion.*;
import ddf.minim.*;
Minim minim1;
AudioPlayer player1;
Minim minim2;
AudioPlayer player2;
Minim minim3;
AudioPlayer player3;
Minim minim4;
AudioPlayer player4;
Minim minim5;
AudioPlayer player5;
Minim minim6;
AudioPlayer player6;
LeapMotion leap;
PImage img0;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
PImage img11;
PImage img12;
PImage img13;
PImage img14;
PImage img15;
PImage img16;
void setup() {
size(800, 500, P3D);
img0=loadImage("234484-13031Q3353876_burned (1).png");
img1=loadImage("234484-13031Q3353876_burned (2).png");
img2=loadImage("234484-13031Q3353876_burned (3).png");
img3=loadImage("234484-13031Q3353876_burned (4).png");
img4=loadImage("234484-13031Q3353876_burned (5).png");
img5=loadImage("Fireball_NSMB.png");
img6=loadImage("53243.png");
img7=loadImage("53244.png");
img8=loadImage("53245.png");
img9=loadImage("53246.png");
img10=loadImage("53247.png");
img11=loadImage("53248.png");
img12=loadImage("53249.png");
img13=loadImage("53240.png");
img14=loadImage("53241.png");
img15=loadImage("53242.png");
img16=loadImage("532421.png");
minim1 = new Minim(this);
//player1 = minim1.loadFile("Amazing Grace.mp3");
//minim2 = new Minim(this);
//player2 = minim2.loadFile("Amazing Grace.mp3");
//minim3 = new Minim(this);
//player3 = minim3.loadFile("Amazing Grace.mp3");
minim4 = new Minim(this);
player4 = minim4.loadFile("thunder.wav");
minim5 = new Minim(this);
player5 = minim5.loadFile("explosion2.mp3");
//minim6 = new Minim(this);
//player6 = minim6.loadFile("Amazing Grace.mp3");
imageMode(CENTER);
//player1.isPlaying() == false;
//player2.isPlaying() == false;
//player3.isPlaying() == false;
player4.pause();
player5.pause();
//player6.isPlaying() == false;
leap = new LeapMotion(this);
}
float nowX=0, nowY, nowA=0;
void draw() {
background(255);
for (Hand hand : leap.getHands ()) {
textSize(20);
PVector hand_position = hand.getPosition();
switch(hand.getOutstrechtedFingers().size()) {
case 0:
{
text("please use your hand to make your magic", 400, 250);
}
break;
case 1:
{
image(img16, 400, 250, 800, 500);
float hand_time= hand.getTimeVisible();
float i=400+hand_time*300;
if (i<1000) {
pushMatrix();
image(img10, hand_position.x, hand_position.y, i+300, i+300);
popMatrix();
player4.play();
} else {
image(img9, 400, 250, 800, 500);
player4.play();
}
}
break;
case 2:
{
background(255);
float hand_time= hand.getTimeVisible();
float i=100+hand_time*300;
if (i<500) {
pushMatrix();
image(img11, hand_position.x, hand_position.y, i+300, i+300);
popMatrix();
} else {
image(img12, 400, 250, 800, 500);
}
}
break;
case 3:
{
image(img15, 400, 250, 800, 500);
float hand_time= hand.getTimeVisible();
float i=10+hand_time*100;
if (i<200) {
pushMatrix();
image(img13, hand_position.x, hand_position.y, i+300, i+300);
popMatrix();
} else {
image(img14, 400, 250, 800, 500);
}
}
break;
case 4:
{
image(img7, 400, 250, 800, 500);
pushMatrix();
image(img4, hand_position.x, hand_position.y-100, 200, 200);
popMatrix();
}
break;
case 5:
{
image(img6, 400, 250, 800, 500);
float hand_time= hand.getTimeVisible();
float i=200-hand_time*100;
if (i>0) {
pushMatrix();
image(img5, hand_position.x, hand_position.y+10-i, i+50, i);
popMatrix();
} else {
image(img8, 400, 250, 800, 500);
player5.play();
}
}
// player1.isPlaying() == false;
//player2.isPlaying() == false;
// player3.isPlaying() == false;
minim4.stop();
minim5.stop();
//player6.isPlaying() == false;
break;
}
hand.draw();
}
}






沒有留言:
張貼留言