2015年3月30日 星期一

偵測手掌可以生出火球
import de.voidplus.leapmotion.*;
LeapMotion leap;

PImage img0;
void setup(){
 
  size(600,600,P3D);
  leap=new LeapMotion(this);
   img0=loadImage("234484-13031Q3353876_burned (1).png");
   imageMode(CENTER);
}
void draw(){
   
background(255);
  for(Hand hand:leap.getHands()){
    int n=hand.getOutstrechtedFingers().size();
    println(n);
    PVector hand_position    = hand.getPosition();
   
    if(n==5||n==4) image(img0,hand_position.x,hand_position.y-100,200,200);
    hand.draw();
 fill(0);stroke(0);
  }
}

沒有留言:

張貼留言