// week06_1_ellipse_translate_push_rotate_box_pop
void setup(){
size(500,500,P3D);
}
void draw(){
background(142);
ellipse(width/2,height/2,200,200);
translate(width/2,height/2);
pushMatrix();
if(mousePressed) rotateZ(radians(frameCount));
box(100,30,30);
popMatrix();
}
// week06_2_ellipse_translate_push_rotate_translate_box_pop
void setup(){
size(500,500,P3D);
}
void draw(){
background(142);
ellipse(width/2,height/2,200,200);
translate(width/2,height/2);
pushMatrix();
if(mousePressed) rotateZ(radians(frameCount));
translate(-50,0,0);
box(100,30,30);
popMatrix();
}
// week06_3_push_translate_rotate_translate_box_pop
void setup(){
size(500,500,P3D);
}
void draw(){
background(142);
ellipse(width/2,height/2,200,200);
translate(width/2,height/2);
pushMatrix();
translate(x,y);
if(mousePressed && mouseButton==RIGHT){
rotateZ(radians(frameCount));
}
translate(-50,0,0);
box(100,30,30);
popMatrix();
}
float x = 0, y = 0;
void mouseDragged(){
x += mouseX - pmouseX;
x += mouseY - pmouseY;
}
// week06_4_push_T_R_T_box_pop
void setup(){
size(500,400,P3D);
}
void draw(){
background(255);
translate(width/2, height/2);
sphere(10);
box(200,50,25);
fill(252,131,77);
pushMatrix();
translate(x, y);
if(mousePressed) rotateZ(radians(frameCount));
translate(25,0,0);
box(50,25,50);
popMatrix();
}
float x = 0, y = 0;
void mouseDragged(){
x += mouseX - pmouseX;
y += mouseY - pmouseY;
println("x:" + x + "y:" + y);
}
// week06_5_push_T_box_push_T_R_T_box_pop_pop
void setup(){
size(500,400,P3D);
}
void draw(){
background(255);
translate(width/2, height/2);
sphere(10);
fill(252,131,77);
pushMatrix();
translate(x,y);
box(200,50,25);
pushMatrix();
translate(100, 0);
rotateZ(radians(frameCount));
translate(25,0,0);
box(50,25,50);
popMatrix();
popMatrix();
}
float x = 0, y = 0;
void mouseDragged(){
x += mouseX - pmouseX;
y += mouseY - pmouseY;
println("x:" + x + "y:" + y);
}
// week06_6_push_box_push_TRT_box_push_TRT_box_pop_pop_pop
void setup(){
size(500,400,P3D);
}
void draw(){
background(255);
translate(width/2, height/2);
sphere(10);
fill(252,131,77);
pushMatrix();
box(50,200,25);
pushMatrix();
translate(x,y);
if(mousePressed) rotateZ(radians(frameCount));
translate(100,0);
box(200,50,25);
pushMatrix();
translate(100, 0);
rotateZ(radians(frameCount));
translate(25,0,0);
box(50,25,50);
popMatrix();
popMatrix();
popMatrix();
}
float x = 0, y = 0;
void mouseDragged(){
x += mouseX - pmouseX;
y += mouseY - pmouseY;
println("x:" + x + "y:" + y);
}
// week06_7_push_RRT_many_TRT_inside_pop
void setup(){
size(500,800,P3D);
}
void draw(){
background(255);
translate(width/2, height/2);
sphere(10);
fill(252,131,77);
pushMatrix();
if(mousePressed && mouseButton==RIGHT) rotateZ(radians(frameCount));
if(mousePressed && mouseButton==RIGHT) rotateY(radians(frameCount));
translate(0,-100);
translate(x,y);
box(50,200,25);
pushMatrix();
translate(0,-100);
//if(mousePressed)
rotateZ(radians(frameCount));
translate(100,0);
box(200,50,25);
pushMatrix();
translate(100, 0);
rotateZ(radians(frameCount));
translate(25,0,0);
box(50,25,50);
popMatrix();
popMatrix();
popMatrix();
}
float x = 0, y = 0;
void mouseDragged(){
x += mouseX - pmouseX;
y += mouseY - pmouseY;
println("x:" + x + "y:" + y);
}
沒有留言:
張貼留言