earth
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(){
background(128);
noStroke();
translate(width/2,height/2);
rotateY(radians(frameCount));
shape(globe);
}
gundam
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
//Q: resize會叫什麼函式? s=width/27;
}
void draw(){
background(128);
translate(width/2,height*3/4);
rotateY(radians(frameCount));
scale(10,10,10);
rotateZ(PI);
shape(gundam);
}
倒著的gundam
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw()
{
scale(10,10,10); //scale(x,y,z)可調大模型的縮放比例
shape(gundam);
}
移動鋼彈到中間
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw()
{
translate(250,0,0); //把鋼彈往右移動250
scale(10,10,10);
shape(gundam);
}
轉圈圈轉起來
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw()
{
rotate(1); //單位是radians()
translate(250,0,0);
scale(10,10,10);
shape(gundam);
}
迴轉鋼彈(X)
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw()
{
rotate(radians(frameCount));
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);
}
鋼彈&地球對比
地球NO.2
PImage img;
void setup()
{
size(300,300,P3D);
img = loadImage("earth.jpg");
}
void draw()
{
image(img,0,0);
}
對比NO.2
設定貼圖
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);
//sphere(100);
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);
//sphere(100);
translate(300/2,300/2);
shape(globe);
}













沒有留言:
張貼留言