2016年3月10日 星期四

Week 03

import de.voidplus.leapmotion.*;
LeapMotion leap;

int PT_NO=100;
PVector[][] pt=new PVector[5][PT_NO];
void setup() {
  size(640, 480, P3D);
  colorMode(HSB, 100);
  background(0);
  for (int f=0; f<5; f++)
    for (int i=0; i0; i--) {      

      pt[f][i].x=pt[f][i-1].x;
      pt[f][i].y=pt[f][i-1].y;
      //pt[f][i].z=pt[f][i-1].z;
    }
  for (Hand hand : leap.getHands ()) {
    for (Finger finger : hand.getFingers ()) {
      int f=finger.getType();
      PVector now =finger.getPosition();
      pt[f][0].x=now.x;
      pt[f][0].y=now.y;
      //pt[f][0].y=now.z*2-90;
    }
  }


  translate(width/2, height/2, 0);
  rotateY(radians(frameCount/4.0));
  translate(-width/2, -height/2, 0);

  drawStroke(pt);



  stroke(60, 100, 100);
  for (int i=0; i<640; i+=20)
    for (int j=0; j<480; j+=20) {
      noFill(); 
      rect(i, j, 20, 20);
    }
}

期中作品

貓狗養成遊戲,可以透過體感裝置和虛擬世界的貓狗互動。

範例圖:

沒有留言:

張貼留言