1. 進擊的小小兵 https://youtu.be/YE6FHl5CmcE
2. 火柴人格鬥 https://youtu.be/sdYt732ihfs
3D畫畫過程重播
PVector pt;
ArrayList<PVector>history;
void setup(){
size(600,400);
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));
//println(mouseX);
}
PVector pt;
ArrayList<PVector>history;
void setup(){
size(600,400);
pt=new PVector(width/2,height/2);
history=new ArrayList<PVector>(0);
}
void draw(){
background(255);
for(PVector nowPt:history){
fill(255,0,0);noStroke(); ←軌跡無黑色外框
ellipse(nowPt.x,nowPt.y,3,3);
}
}
void mouseMoved(){
history.add(new PVector(mouseX,mouseY));
//println(mouseX);
}
PVector pt;
ArrayList<PVector>history;
void setup(){
size(600,400);
pt=new PVector(width/2,height/2);
history=new ArrayList<PVector>(0);
}
void draw(){
background(255);
for(PVector nowPt:history){
fill(255,0,0);stroke(0); ←軌跡有黑色外框
ellipse(nowPt.x,nowPt.y,3,3);
}
}
void mouseMoved(){
history.add(new PVector(mouseX,mouseY));
//println(mouseX);
}
加入leap motion
import de.voidplus.leapmotion.*;
LeapMotion leap;
PVector pt;
ArrayList<PVector>history;
void setup(){
size(600,400);
leap=new LeapMotion(this);
pt=new PVector(width/2,height/2);
history=new ArrayList<PVector>(0);
}
void draw(){
background(255);
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));
//println(mouseX);
//}
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(600,400);
leap=new LeapMotion(this);
pt=new PVector(width/2,height/2);
history=new ArrayList<PVector>(0);
}
void draw(){
background(255);
for(PVector nowPt:history){
fill(255,0,0);noStroke();
ellipse(nowPt.x,nowPt.y,10,10);
}
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=finger2.getPosition();
history.add(new PVector(pos.x,pos.y));
pos=finger3.getPosition();
history.add(new PVector(pos.x,pos.y));
pos=finger4.getPosition();
history.add(new PVector(pos.x,pos.y));
pos=finger5.getPosition();
history.add(new PVector(pos.x,pos.y));
}
}
//void mouseMoved(){
// history.add(new PVector(mouseX,mouseY));
//println(mouseX);
//}
LeapMotion leap;
PVector pt;
ArrayList<PVector>history;
ArrayList<PVector>history2;
ArrayList<PVector>history3;
ArrayList<PVector>history4;
ArrayList<PVector>history5;
void setup(){
size(600,400);
leap=new LeapMotion(this);
pt=new PVector(width/2,height/2);
history=new ArrayList<PVector>(0);
}
void draw(){
background(255);
for(PVector nowPt:history){
fill(255,0,0);noStroke();
ellipse(nowPt.x,nowPt.y,10,10);
}
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=finger2.getPosition();
history.add(new PVector(pos.x,pos.y));
pos=finger3.getPosition();
history.add(new PVector(pos.x,pos.y));
pos=finger4.getPosition();
history.add(new PVector(pos.x,pos.y));
pos=finger5.getPosition();
history.add(new PVector(pos.x,pos.y));
}
}
//void mouseMoved(){
// history.add(new PVector(mouseX,mouseY));
//println(mouseX);
//}

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(now Pt.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));
//}
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
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
}
for(PVector nowPt : history5){
fill(255,0,255);myBall(now
}
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));
//}
沒有留言:
張貼留言