2020年6月20日 星期六

Week18


首先我們來讓它變大
PShape gundam;
void setup()
{
  size(500,500,P3D);
  gundam=loadShape("Gundam.obj");
}
void draw()
{
  scale(10,10,10);
  shape(gundam);
}
可是他卡在邊邊,所以我們要把它移到中間

PShape gundam;
void setup()
{
  size(500,500,P3D);
  gundam=loadShape("Gundam.obj");
}
void draw()
{
  translate(250,0,0);
  scale(10,10,10);
  shape(gundam);
}
我們終於看到真面目啦~

PShape gundam;
void setup()
{
  size(500,500,P3D);
  gundam=loadShape("Gundam.obj");
}
void draw()
{
  rotate(1);
  translate(250,0,0);
  scale(10,10,10);
  shape(gundam);

}
                                                                 這是一個失敗的旋轉



PShape gundam;
void setup()
{
  size(500,500,P3D);
  gundam=loadShape("Gundam.obj");
}
void draw()
{
  background(128);
  translate(250,400,0);
  scale(10,-10,10);
  rotateY(radians(frameCount));
  shape(gundam);

}
                                   這樣他就會像在展示櫃裡的模型一樣轉圈~蠻有質感的吧~




                                                                再來我們要來做地球~

PImage img;
void setup(){
  size(300,300,P3D);
  img = loadImage("earth.jpg");
}
void draw(){
  image(img,0,0);

}
PImage img;
PShape globe;
void setup(){
  size(300,300,P3D);
  img = loadImage("earth.jpg");
  globe = createShape(SPHERE,100);
}
void draw(){
  image(img,0,0);
  shape(globe);
}                                                            
然後我們加一個立體圓圈進去

PImage img;
PShape globe;
void setup(){
  size(300,300,P3D);
  img = loadImage("earth.jpg");
  globe = createShape(SPHERE,100);
  globe.setTexture(img);
}
void draw(){
  //image(img,0,0);
  shape(globe);
}
用地圖將圓圈包起來


PImage img;
PShape globe;
void setup(){
  size(300,300,P3D);
  img = loadImage("earth.jpg");
  globe = createShape(SPHERE,100);
  globe.setTexture(img);
}
void draw(){
  //image(img,0,0);
  translate(300/2,300/2);
  shape(globe);
}
然後我們把它移到中間

PImage img;

PShape globe;
void setup(){
  size(300,300,P3D);
  img = loadImage("earth.jpg");
  globe = createShape(SPHERE,100);
  globe.setStroke(false);
  globe.setTexture(img);
}
void draw(){
  //image(img,0,0);
  background(128);
  translate(300/2,300/2);
  rotateY(radians(frameCount));
  shape(globe);
}
最後會跟剛剛那個鋼彈一樣,會旋轉,相當的有質感。

沒有留言:

張貼留言