2016年11月17日 星期四

week10_20161117_教學軟體設計

上課進度
1. 簡單複習上週Leap Motion 接金幣
2.陣列、存檔、成績排名、sort計算
3.如何做「剪刀石頭布」的猜拳判斷
4.用陣列做「3D畫畫過程重播」示範

作品示範與欣賞

2016互動技術概論-進擊的小小兵(郭芳蓁、陳昱宏)


2016 互動技術 期中作品 火柴人格鬥




knight rider 霹靂遊俠的霹靂燈 (KITT)





戴上VR神器 「怒碎」翠玉白菜不是夢

http://a.udn.com/focus/2016/11/15/25831/index.html




The Matrix - Bullet time + Helipad Fight Scene Super High Quality


電腦3D 特效



3D畫畫過程

PVector pt;ArrayList<PVector>history;void setup(){  size(600,400,P3D);  pt=new PVector(width/2, height/2); history=new ArrayList<PVector>(0);}void draw(){  for(PVector nowPt : history){    ellipse(nowPt.x,nowPt.y,3,3);  座標體積橢圓形做出來  }}void mouseMoved(){  history.add(new PVector(mouseX, mouseY));}




結果






PVector pt;
ArrayList<PVector>history;
void setup(){
  size(600,400,P3D);
  pt=new PVector(width/2, height/2);
 history=new ArrayList<PVector>(0);
}

void draw(){
  for(PVector nowPt : history){
    fill(255,0,0); noStroke();
    ellipse(nowPt.x,nowPt.y,3,3);
  }
}
void mouseMoved(){
  history.add(new PVector(mouseX, mouseY));
}



加上「leapmotion」

import de.voidplus.leapmotion.*;
LeapMotion leap;
PVector pt;
ArrayList<PVector>history;
void setup(){
  size(600,400,P3D);
  leap=new LeapMotion(this);
  pt=new PVector(width/2, height/2);
 history=new ArrayList<PVector>(0);

}

void draw(){
  for(PVector nowPt : history){
    fill(255,0,0); noStroke();
    ellipse(nowPt.x,nowPt.y,10,10);
  }
   for(Hand hand:leap.getHands()){
   PVector pos=hand.getPosition();
   history.add(new PVector(pos.x,pos.y));
}
}

//void mouseMoved(){
  //history.add(new PVector(mouseX, mouseY));

//}


<更新版> 五根手指頭不同顏色的3D軌跡
import de.voidplus.leapmotion.*;
LeapMotion leap;
PVector pt;
ArrayList<PVector> history;
ArrayList<PVector> history2;
ArrayList<PVector> history3;
ArrayList<PVector> history4;
ArrayList<PVector> history5;
void setup(){
size(640,480,P3D);//Need P3D 3D function (ball, translate, rotate, pushMatrix, popMatrix)
leap=new LeapMotion(this);
pt=new PVector(width/2, height/2);
history=new ArrayList<PVector>(0);
history2=new ArrayList<PVector>(0);
history3=new ArrayList<PVector>(0);
history4=new ArrayList<PVector>(0);
history5=new ArrayList<PVector>(0);
}
void myBall(float x, float y, float z){
pushMatrix();//backup translate/rotate matrix
translate(x,y,z*10);// z need to be x10 
sphere(10); 


popMatrix();//restore the translate/rotate matrix
}
void draw(){
background(255);
lights();// lighs will let 3D ball to look like 3D
translate(width/2, height/2);//This 3 lines (Translate, rotate, translate) 
rotateY(radians(frameCount));// can let the balls rotating in the center of screen
translate(-width/2, -height/2);//
noStroke();
for(PVector nowPt : history){
fill(255,0,0); myBall(nowPt.x, nowPt.y, nowPt.z);
}
for(PVector nowPt : history2){
fill(255,255,0); myBall(nowPt.x, nowPt.y, nowPt.z);
}
for(PVector nowPt : history3){
fill(0,255,0); myBall(nowPt.x, nowPt.y, nowPt.z);
}
for(PVector nowPt : history4){
fill(0,0,255);myBall(nowPt.x, nowPt.y, nowPt.z);
}
for(PVector nowPt : history5){
fill(255,0,255);myBall(nowPt.x, nowPt.y, nowPt.z);
}
for( Hand hand : leap.getHands() ){
hand.draw();
Finger finger = hand.getThumb();
Finger finger2 = hand.getIndexFinger();
Finger finger3 = hand.getMiddleFinger();
Finger finger4 = hand.getRingFinger();
Finger finger5 = hand.getPinkyFinger();
PVector pos;
pos= finger.getPosition();
history.add(new PVector(pos.x,pos.y, pos.z));
pos = finger2.getPosition();
history2.add(new PVector(pos.x,pos.y, pos.z));
pos = finger3.getPosition();
history3.add(new PVector(pos.x,pos.y, pos.z));
pos = finger4.getPosition();
history4.add(new PVector(pos.x,pos.y, pos.z));
pos = finger5.getPosition();
history5.add(new PVector(pos.x,pos.y, pos.z));
}
}
//void mouseMoved(){
// history.add(new PVector(mouseX, mouseY));
//}








沒有留言:

張貼留言