2021年9月27日 星期一

week01 安

 今天課堂的任務一是使用Proceesing畫企鵝

程式碼如下:

size(600,600);
background(#30A2D8);
fill(255);//填充 
noStroke();//不要筆觸色(頭)
rect(100,100,400,400);//矩陣

stroke(128);
strokeWeight(5);//eyes
ellipse(200,300, 30,30);//圓形
ellipse(400,300, 30,30);

noStroke();
fill(#D88730);
ellipse(300,400,200,100);

stroke(255);
line(200,400,400,400);

任務二:讓眼睛跟著鼠標移動

程式碼如下:
void setup(){
  size(600,600);//設定函式只做一次
}
void draw(){
  background(#30A2D8);
  fill(255);//填充 
  noStroke();//不要筆觸色(頭)
  rect(100,100,400,400);//矩陣

  stroke(128);
  strokeWeight(5);//eyes
  ellipse(mouseX,mouseY, 30,30);//步驟一的部分改成mouseX mouseY
  ellipse(400,300, 30,30);

  noStroke();
  fill(#D88730);
  ellipse(300,400,200,100);

  stroke(255);
  line(200,400,400,400);
}



沒有留言:

張貼留言