2015年4月13日 星期一

WEEK07

import de.voidplus.leapmotion.*;
LeapMotion leap;
PImage imgAcc;
PImage imgBG;
void setup()
{
  size(800,600, P3D);
  imgBG = loadImage("bg.jpg");
  imgBG.resize(800,600);

  imgAcc = loadImage("accurate.png");
  leap = new LeapMotion(this);
}
int countDown = 30;

void draw()
{
  background(imgBG);
  if(countDown==0) background(255,0,0);
  fill(0);textSize(30);text("Time:"+countDown,600,50);
  if(frameCount%60==0 && countDown>0) countDown--;
  for(Hand hand : leap.getHands() ){
    hand.draw();
    myDraw(hand.getIndexFinger().getPosition());
  }
}
void myDraw(PVector pos){
  pushMatrix();
//  fill(255,0,0); sphere(20);
  image(imgAcc,pos.x-50,pos.y-50,100,100);
  popMatrix();
}

沒有留言:

張貼留言