# 自畫像

```javascript=
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
}
function draw() {
background(255);
noFill();
fill(0)
textSize(25)
text("滑鼠的座標為:"+int(mouseX)+", y軸為:"+int(mouseY),50,50)
fill(244+random(-5,5),241+random(-5,5),187+random(-5,5))
fill(255)
beginShape()
strokeWeight(5)
curveVertex(382,206)
curveVertex(382,206)//左臉第一個點
curveVertex(410,296)
curveVertex(480,380)
curveVertex(600,310)
curveVertex(640,238)
curveVertex(640,238)//右臉第一個點
strokeWeight(1)
endShape()//臉輪廓結束
beginShape()
strokeWeight(5)
curveVertex(382,206)//瀏海左半邊起點
curveVertex(382,206)
curveVertex(460,185+ random(-2,2))
curveVertex(515,145+ random(-2,2))
curveVertex(545,102)
curveVertex(545,102)
strokeWeight(2)
endShape()//瀏海左半邊結束
beginShape()
strokeWeight(5)
curveVertex(545,102)//瀏海右半邊起點
curveVertex(545,102)
curveVertex(576,150)
curveVertex(628,184)
curveVertex(628,184)
strokeWeight(2)
endShape()//瀏海右半邊結束
beginShape()
strokeWeight(5)
vertex(628,184)//鬢角起點
vertex(628,184)
vertex(640,238)
vertex(663,193)
vertex(663,193)
strokeWeight(2)
endShape()//鬢角結束
beginShape()
strokeWeight(5)
curveVertex(663,193)//耳朵起點
curveVertex(663,193)
curveVertex(680,210)
curveVertex(660,250)
curveVertex(629,270)
curveVertex(629,270)
strokeWeight(1)
endShape()//耳朵結束
beginShape()
strokeWeight(5)
curveVertex(531,363)//脖子左邊
curveVertex(531,363)
curveVertex(520,420)
curveVertex(471,463)
curveVertex(471,463)
strokeWeight(1)
endShape()
beginShape()
strokeWeight(5)
curveVertex(636,270)//脖子右邊
curveVertex(636,270)
curveVertex(635,345)
curveVertex(671,420)
curveVertex(720,463)
curveVertex(720,463)
strokeWeight(1)
endShape()
beginShape()
strokeWeight(5)
curveVertex(471,463)
curveVertex(471,463)
curveVertex(598,492)
curveVertex(720,463)
curveVertex(720,463)
strokeWeight(1)
endShape()//脖子結束
beginShape()
strokeWeight(2)
noFill()
arc(550,170,360,320,60,1,PI,PI)//後腦勺
arc(666,30,130,140,60,1,PI,PI)//包包頭
fill(255)
curveVertex(382,112)
curveVertex(382,112)
curveVertex(370,165+ random(-5,5))
curveVertex(386,222)
curveVertex(386,222)//補瀏海
strokeWeight(2)
endShape()
if(mouseIsPressed){
beginShape()
strokeWeight(3)
fill(199,220,255)
rect(375,200,90,80 ,25,30,40,50)
line(465,218 ,490,218)
rect(485,198,100,83 ,30,30,40,50)//眼鏡
fill(255)
ellipse(425,230,70,20)
fill(0)
ellipse(424+mouseX/50,228,5)
fill(255)
ellipse(534,230,72,20)
fill(0)
ellipse(531+mouseX/50,228,5)
}
else
{
strokeWeight(3)
fill(mouseX, 10+frameCount/5, 140+frameCount/5)
rect(375,200,90,80 ,25,30,40,50)
line(465,218 ,490,218)
rect(485,198,100,83 ,30,30,40,50)//眼鏡
}
strokeWeight(1)
line(466,247 ,450,280)
line(450,280 ,466,295)//鼻子
if(mouseIsPressed){
beginShape()
fill(255,130,100)
rect(445,310+ random(-2,2),80,40)
```