2025年4月24日 星期四

傅士源的...12753096 week10

 //week10_1_postman_head_body

//頭、身體、手臂、手肘、腳
size(560,560);
PImage postman=loadImage("postman.png");
PImage head=loadImage("head.png");
PImage body=loadImage("body.png");
background(#FFFFF2);
image(postman,0,0);//基礎的郵差先生(全身)
fill(255,0,255,128);//半透明的紫色
rect(0,0,560,560);//蓋上去
image(head,0,0);//在畫頭
image(body,0,0);//在畫身體

//week10_2_postman_head_body_push_trt_pop
PImage postman,head,body;
void setup(){
  size(560,560);
  postman=loadImage("postman.png");
  head=loadImage("head.png");
  body=loadImage("body.png");
}
void draw(){
  background(#FFFFF2);
  image(postman,0,0);//基礎的郵差先生(全身)
  fill(255,0,255,128);//半透明的紫色
  rect(0,0,560,560);//蓋上去
  pushMatrix();
  translate(+236,+231);//再放會去正確的位置
  rotate(radians(mouseX));
  translate(-236,-231);//把頭的旋轉中心,放到(0,0)
    image(head,0,0);//在畫頭
  popMatrix();
  image(body,0,0);//在畫身體
}

//week10_3_postman_head_body_uparm1_hand1_push_trt_pop
PImage postman,head,body, uparm1, hand1;
void setup(){
  size(560,560);
  postman=loadImage("postman.png");
  head=loadImage("head.png");
  body=loadImage("body.png");
  uparm1=loadImage("uparm1.png");
  hand1=loadImage("hand1.png");
}
void draw(){
  background(#FFFFF2);
  image(postman,0,0);//基礎的郵差先生(全身)
  fill(255,0,255,128);//半透明的紫色
  rect(0,0,560,560);//蓋上去
  pushMatrix();
    translate(+185,+261);
    rotate(radians(mouseX));
    translate(-185,-261);
    image(uparm1,0,0);
    pushMatrix();
      translate(+116,+265);
      rotate(radians(mouseX));
      translate(-116,-265);
      image(hand1,0,0);
    popMatrix();
  popMatrix();
  
  pushMatrix();
    translate(+236,+231);
    translate(-236,-231);
  translate(-236,-231);//把頭的旋轉中心,放到(0,0)
    image(head,0,0);//在畫頭
  popMatrix();
  image(body,0,0);//在畫身體
}

沒有留言:

張貼留言