size(600,600);//(1)大小
background(#30A4D8);//(2)
stroke(204,102,0);//
strokeWeight(5);//
rect(100,100, 400,400);//
ellipse(200,300, 30,30);//
ellipse(400,300, 30,30);//
ellipse(300,400, 200,100);//
line(200,400, 400,400);//
畫一隻呆企鵝
size(600,600);//大小
background(#30A4D8);//背景
fill(255);//臉
noStroke();
rect(100,100,400,400);
stroke(128);//眼
strokeWeight(5);
ellipse(200,300, 30,30);
ellipse(400,300, 30,30);
noStroke();//嘴
fill(#CC6600);
ellipse(300,400, 200,100);
stroke(255);//嘴中間的線
line(200,400, 400,400);
另一隻呆企鵝
void setup(){
size(600,600);
}
void draw(){
background(#30A4D8);
fill(255);//臉
noStroke();
rect(100,100,400,400);
stroke(128);//眼
strokeWeight(5);
ellipse(200,300, 30,30);
ellipse(400,300, 30,30);
noStroke();//嘴
fill(#CC6600);
ellipse(300,400, 200,100);
stroke(255);//嘴中間的線
line(200,400, 400,400);
}
把設置背景跟畫臉的部分分開
然後
stroke(128);//眼
strokeWeight(5);
ellipse(200,300, 30,30);改成ellipse(mouseX,mouseY, 30,30);
ellipse(400,300, 30,30);
讓左眼跟著滑鼠移動



沒有留言:
張貼留言