--- tags: 程式設計 --- # 409000618 陳昱廷自畫像 ## 設定視窗大小以及背景 --- ```javascript= function setup() { createCanvas(windowWidth, windowHeight); } function draw() { background("#6FB7B7"); textSize(90) fill(255)} // text("X軸"+mouseX+",Y軸:"+mouseY,50,50)//X軸、Y軸座標設定 ``` --- ## face設定 --- ```javascript= fill("#ffecd1"); noStroke(); beginShape(); curveVertex(760,170) curveVertex(760,170) curveVertex(600,250) curveVertex(550,390) curveVertex(530,540) curveVertex(590,590) curveVertex(690,630) curveVertex(830,570) curveVertex(890,460) curveVertex(870,371) curveVertex(860,300) curveVertex(790,240) curveVertex(790,170) curveVertex(500,170) endShape(); ``` --- ## right hair及left hair 設定 --- ```javascript= //right hair fill("#642100") noStroke(); beginShape(); curveVertex(810,130) curveVertex(810,400) endShape(); //left hair fill("#642100") beginShape(); curveVertex(980,150) curveVertex(840,300) ``` ## right bang以及left banges設定 --- ```javascript= endShape(); //右邊瀏海 fill(" #272727") beginShape(); curveVertex(680,200) curveVertex(770,150) curveVertex(820,150) curveVertex(900,350) curveVertex(745,300) curveVertex(630,190) curveVertex(730,190) endShape(); //左邊瀏海 fill(" #272727") beginShape(); curveVertex(480,110) curveVertex(570,150) curveVertex(620,150) curveVertex(760,130) curveVertex(740,330) curveVertex(445,310) curveVertex(500,200) curveVertex(500,180) endShape(); ``` --- ## eyebrow跟eyes 設定 ___ ```javascript= fill(" #4F4F4F") beginShape();//左邊眉毛 curveVertex(730,360) curveVertex(730,360) curveVertex(755,352) curveVertex(780,350) curveVertex(805,352) curveVertex(830,360) curveVertex(830,360) endShape() beginShape();//右邊眉毛 curveVertex(580,360) curveVertex(580,360) curveVertex(605,352) curveVertex(630,350) curveVertex(655,352) curveVertex(680,360) curveVertex(680,360) endShape(); fill(255) stroke (0) strokeWeight(7) ellipse(635,390,50)//左邊大眼睛 ellipse(770,390,50)//右邊大眼睛 ellipse(770,390,30)//右眼 ellipse(630+mouseX/32,390+mouseY/23,30)//左眼 ``` --- ## nose以及mouth 設定 --- ```javascript= //nose line(700,430,685,470) line(685,470,705,470) line(697,429,707,470) fill("#212529") //mouth stroke(0) line(645,500,740,500) noFill() beginShape() curveVertex(645,500) curveVertex(645,500) curveVertex(670,525) curveVertex(695,530) curveVertex(720,525) curveVertex(740,500) curveVertex(740,500) endShape() fill("#dd1c1a") //嘴巴內 beginShape() curveVertex(660,515) curveVertex(670,525) curveVertex(675,515) curveVertex(690,515) curveVertex(715,515) curveVertex(720,525) curveVertex(725,520) endShape(); } ``` --- ## 完成圖 ![](https://i.imgur.com/bGsqIS0.png)