/* * FaceMap class - holds all informaiton about one mapped * face and is able to draw itself. */ // other variables can be in here too // these control the colors used const bg_color = [225, 206, 187]; const fg_color = [151, 102, 52]; const stroke_color = [95, 52, 8]; function Face() { // these are state variables for a face // (your variables may be different) this.hairStyle = 1; // 1-4 /* * Draw a face with position lists that include: * chin, right_eye, left_eye, right_eyebrow, left_eyebrow * bottom_lip, top_lip, nose_tip, nose_bridge, */ this.draw = function(positions) { // let chin_p1 = map(s1,0,100,0.6,1.8); // let chin_p2 = map(s2,0,100,4.2,4.92); // let face_h = map(s3,0,100,0.6,1); // let R_eyebrow_dis = map(s4,0,100,-3,2); // let L_eyebrow_dis = map(s5,0,100,-3,2); // let hairC = int(map(s6,0,100,1,5)); // let skinC = int(map(s7,0,100,1,5)); // let mouthS = map(s8, 0, 100, 0, 0.5); // let eyeS = int(map(s9, 0, 100, 1, 4)); // let hairS = int(map(s10, 0, 100, 1, 4)); // let decoration = int(map(s11,0,100,1,4)) let chin_p1 = 1; let chin_p2 = 4.5; let face_h = 1; let rightEyebrow = 1; let leftEyebrow = 1; let hairC = 1; let skinC = 1; let mouthShape = 0.25; let eyeShape = 1; let hairStyle = this.hairStyle; let decoration = 1; let shoulder = 0; let h1 = '#D2542C'; let h2 = '#F2D896'; let h3 = '#F2EBD8'; let h4 = '#29130B'; let h5 = '#A9A096'; let sk1 = '#F2C6AE'; let sk2 = '#D9C2BA'; let sk3 = '#EDB8AB'; let sk4 = '#C48485'; let sk5 = '#F9EBD0'; push(); let nose_bridge_y = positions.nose_bridge[0][1]; translate(0, nose_bridge_y/2); scale(0.33); stroke(0); strokeWeight(0.1); if(skinC == 1){ fill(sk1); }else if(skinC ==2){ fill(sk2) }else if(skinC == 3){ fill(sk3) }else if(skinC ==4){ fill(sk4) }else if(skinC ==5){ fill(sk5) } if(shoulder == 1){ beginShape(); vertex(-10,13); vertex(-9, 12); vertex(-7,10); vertex(-5, 9); vertex(-2.5,8); vertex(-2,7); vertex(-1.8,5); vertex(1.8,5); vertex(2,7); vertex(2.5,8); vertex(5, 9); vertex(7,10); vertex(9, 12); vertex(10,13); endShape(); push(); beginShape(); fill(120) vertex(-10,13); vertex(-9, 12); vertex(-7,10); vertex(-5, 9); vertex(0,12); vertex(5, 9); vertex(7,10); vertex(9, 12); vertex(10,13); endShape(); pop(); } beginShape();//face // fill(242, 197, 174) //chin vertex(chin_p1, 5.7); bezierVertex(-0.3, 6, 0.18, 6, -chin_p1, 5.7); //left face bezierVertex(-2.988-(0.15 * chin_p1), 4.884, -3.12-(0.16 * chin_p2), 4.296, -chin_p2, 3.6-face_h); //forehead vertex(-5.4, -1.2); bezierVertex( -5.7,-9, 5.4, -9, 5.4, -1.2); //right face vertex(chin_p2, 3.6-face_h); bezierVertex(3.12+(0.16 * chin_p2), 4.296, 2.98 + (0.15 * chin_p1), 4.88, chin_p1, 5.7); endShape(CLOSE); //ear beginShape(); vertex(5.4, -1.6); vertex(6, -2.4); vertex(6.3, -2.3); vertex(6.4, -2.2); vertex(6.5, -2); vertex(6.4, -1.5); vertex(6.3, -1); vertex(6, 0) vertex(5.6, 1); vertex(5, 2); vertex(chin_p2 + 0.2, 2.1) endShape(CLOSE); beginShape(); vertex(-5.4, -1.6); vertex(-6, -2.4); vertex(-6.3, -2.3); vertex(-6.4, -2.2); vertex(-6.5,-2); vertex(-6.4, -1.5); vertex(-6.3, -1); vertex(-6, 0) vertex(-5.6, 1); vertex(-5, 2); vertex(-chin_p2 - 0.2, 2.1) endShape(CLOSE); if(eyeShape == 1){ beginShape();//right eye inside fill(250) vertex(1.2, -0.54); bezierVertex(1.56, -0.91, 4.2, -1.69, 3.9,-0.6) bezierVertex(3.6, 0, 3.48, 0.12, 3, 0.48); bezierVertex(1.2, 0.6, 0.9, 0.3, 1.2, -0.54) endShape(CLOSE); fill(95, 147, 167) ellipse(2.28, -0.3, 1.62, 1.44) fill(36, 73, 83) ellipse(2.28, -0.3, 0.6, 0.6) push(); noFill(); push(); beginShape();//right eyelid strokeWeight(0.01); fill(236, 168, 142); vertex(1.2, -0.54); vertex(3.5, -1.55); vertex(1.2, -1.4); endShape(); pop(); beginShape(); fill(0) vertex(1.2, -0.54); bezierVertex(1.56, -0.92, 4.2, -1.69, 3.9, -0.6) vertex(4.2, -1.2); bezierVertex(3.9, -1.5, 3, -1.5, 1.2, -0.6) endShape(CLOSE); pop(); push(); noStroke(); if(hairC == 1){ fill(h1); }else if(hairC == 2){ fill(h2); }else if(hairC == 3){ fill(h3); }else if (hairC == 4){ fill(h4); }else if(hairC == 5){ fill(h5); } beginShape();//right eye brow vertex(0.72, -2.1+0.15*rightEyebrow); bezierVertex(0.72, -2.16+0.2*rightEyebrow, 2.4, -3.3-0.15*rightEyebrow, 4.2, -2.4-0.15*rightEyebrow); vertex(3.6, -2.46-0.15*rightEyebrow); vertex(2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); beginShape();//Left eye brow vertex(-0.72,-2.1+0.15*leftEyebrow); bezierVertex(-0.72, -2.16+0.2*leftEyebrow, -2.4, -3.3-0.15*leftEyebrow, -4.2, -2.4-0.15*leftEyebrow); vertex(-3.6,-2.46-0.15*leftEyebrow); vertex(-2.1,-2.4+0.01*leftEyebrow); endShape(CLOSE); pop(); beginShape();//left eye inside fill(250) vertex(-1.2, -0.54); bezierVertex( -1.56, -0.91, -4.2, -1.69, -3.9, -0.6) bezierVertex( -3.6, 0, -3.48, 0.12, -3, 0.48); bezierVertex(-1.2, 0.6, -0.9, 0.3, -1.2, -0.54) endShape(CLOSE); fill(95, 147, 167) ellipse(-2.28, -0.3, -1.62, 1.44) fill(36, 73, 83) ellipse(-2.28, -0.3, -0.6, 0.6) push(); beginShape();//left eyelid strokeWeight(0.01); fill(236, 168, 142); vertex(-1.2, -0.54); vertex(-3.5, -1.55); vertex(-1.2, -1.4); endShape(); pop(); beginShape(); fill(0) vertex(-1.2, -0.54); bezierVertex( -1.56, -0.92, -4.2, -1.69, -3.9,-0.6) vertex(-4.2, -1.2); bezierVertex(-3.9, -1.5, -3, -1.5, -1.2, -0.6) endShape(CLOSE); }else if(eyeShape ==2){ push() strokeWeight(0.1) fill(255) beginShape(); vertex(4, -0.8); bezierVertex(3.8, 0, 3.5, 0.3, 3.1, 0.5) bezierVertex(2.2, 0.5, 1.8, 0.3, 1.4, 0) vertex(1.2, -0.5); endShape(CLOSE); beginShape(); vertex(-4, -0.8); bezierVertex(-3.8, 0, -3.5, 0.3, -3.1, 0.5) bezierVertex(-2.2, 0.5, -1.8, 0.3, -1.4, 0) vertex(-1.2, -0.5); endShape(CLOSE); noStroke(); fill('#8DD0FF') ellipse(2.5, -0.6, 1.5, 1.3) ellipse(-2.5, -0.6, 1.5, 1.3) fill(0); ellipse(2.5,-0.6, 1, 0.8) ellipse(-2.5,-0.6, 1, 0.8) pop(); push(); push(); strokeWeight(0) fill('#FF9D85') beginShape(); vertex(4.2, -0.7); vertex(3.5, -1.5); vertex(2, -1.5); vertex(1.2, -0.5) endShape(); beginShape(); vertex(-4.2, -0.7); vertex(-3.5, -1.5); vertex(-2, -1.5); vertex(-1.2, -0.5) endShape(); pop(); beginShape(); strokeWeight(0.2); vertex(1.2, -0.5); bezierVertex(1.8, -0.7, 4, -0.8, 4.2, -0.7); endShape(); beginShape(); vertex(-1.2, -0.5); bezierVertex(-1.8, -0.7, -4, -0.8, -4.2, -0.7); endShape(); pop(); // push(); // pop(); if(hairC == 1){ fill(h1); }else if(hairC == 2){ fill(h2); }else if(hairC == 3){ fill(h3); }else if (hairC == 4){ fill(h4); }else if(hairC == 5){ fill(h5); } stroke(0) beginShape();//right eye brow vertex(0.72, -2.1+0.2*rightEyebrow); bezierVertex(0.72, -2.16+0.2*rightEyebrow, 2.4, -3.3-0.15*rightEyebrow, 4.2, -2.4-0.15*rightEyebrow); vertex(3.6, -2.46-0.15*rightEyebrow); vertex(2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); beginShape();//Left eye brow vertex(-0.72, -2.1+0.15*rightEyebrow); bezierVertex(-0.72, -2.16+0.2*rightEyebrow, -2.4, -3.3-0.15*rightEyebrow, -4.2, -2.4-0.15*rightEyebrow); vertex(-3.6, -2.46-0.15*rightEyebrow); vertex(-2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); }else if(eyeShape == 3){ strokeWeight(0.1); fill(10) beginShape(); vertex(1.8, -0.1); vertex(3.15, -0.18); vertex(3.6, -0.36); vertex(4, -1.35); bezierVertex(3.9, -1.3, 2.7, -1.1, 1.62, -1) vertex(1.3, -1); vertex(1.2, -0.45); vertex(1.35,-0.9); vertex(1.62, -0.81); vertex(2.7, -0.9); vertex(3.6, -1.08); vertex(3.78, -1.17); vertex(3.6, -0.36); vertex(3.15, -0.18); vertex(1.8, -0.1); endShape(); beginShape(); vertex(-1.8, -0.1); vertex(-3.15, -0.18); vertex(-3.6, -0.36); vertex(-4, -1.35); bezierVertex(-3.9, -1.3, -2.7, -1.1, -1.62, -1) vertex(-1.3, -1); vertex(-1.2, -0.45); vertex(-1.35,-0.9); vertex(-1.62, -0.81); vertex(-2.7, -0.9); vertex(-3.6, -1.08); vertex(-3.78, -1.17); vertex(-3.6, -0.36); vertex(-3.15, -0.18); vertex(-1.8, -0.1); endShape(); beginShape();//right eye brow vertex(0.72, -2.1+0.2*rightEyebrow); bezierVertex(0.72, -2.16+0.2*rightEyebrow, 2.4, -3.3-0.15*rightEyebrow, 4.2, -2.4-0.15*rightEyebrow); vertex(3.6, -2.46-0.15*rightEyebrow); vertex(2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); beginShape();//Left eye brow vertex(-0.72, -2.1+0.15*rightEyebrow); bezierVertex(-0.72, -2.16+0.2*rightEyebrow, -2.4, -3.3-0.15*rightEyebrow, -4.2, -2.4-0.15*rightEyebrow); vertex(-3.6, -2.46-0.15*rightEyebrow); vertex(-2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); fill(250) beginShape(); vertex(1.2, -0.45); vertex(1.35,-0.9); vertex(1.62, -0.81); vertex(2.7, -0.9); vertex(3.6, -1.08); vertex(3.78, -1.17); vertex(3.6, -0.36); vertex(3.15, -0.18); vertex(1.8, -0.1); endShape();; beginShape(); vertex(-1.2, -0.45); vertex(-1.35,-0.9); vertex(-1.62, -0.81); vertex(-2.7, -0.9); vertex(-3.6, -1.08); vertex(-3.78, -1.17); vertex(-3.6, -0.36); vertex(-3.15, -0.18); vertex(-1.8, -0.1); endShape(); fill(10); ellipse(-2.5,-0.5,1,0.8) ellipse(2.5,-0.5,1,0.8) }else if(eyeShape == 4){ strokeWeight(0.1); fill(255); beginShape(); vertex(4, -0.8); bezierVertex(3.7, 0.5, 3, 0.5, 1.2, 0.5); bezierVertex(1.9, -1.5, 2.3, -1.1, 2.9, -1.2); endShape(); beginShape(); vertex(-4, -0.8); bezierVertex(-3.7, 0.5, -3, 0.5, -1.2, 0.5); bezierVertex(-1.9, -1.5, -2.3, -1.1, -2.9, -1.2); endShape(); fill(0); ellipse(2.5, -0.25, 1.5, 1.5) beginShape(); vertex(1.2,0.5); bezierVertex(1.4, -1.3, 2.3, -1.5, 2.9, -1.45); bezierVertex(3.5, -1.3, 4, -0.8, 4.2, -1.1); bezierVertex(4, -0.8, 3.5,-0.9, 2.9, -1.2); bezierVertex(2.3, -1.1, 1.9, -1, 1.2, 0); endShape() ellipse(-2.5, -0.25, -1.5, 1.5) beginShape(); vertex(-1.2,0.5); bezierVertex(-1.4, -1.3, -2.3, -1.5, -2.9, -1.45); bezierVertex(-3.5, -1.3, -4, -0.8, -4.2, -1.1); bezierVertex(-4, -0.8, -3.5,-0.9, -2.9, -1.2); bezierVertex(-2.3, -1.1, -1.9, -1, -1.2, 0); endShape() if(hairC == 1){ fill(h1); }else if(hairC == 2){ fill(h2); }else if(hairC == 3){ fill(h3); }else if (hairC == 4){ fill(h4); }else if(hairC == 5){ fill(h5); } stroke(0) beginShape();//right eye brow vertex(0.72, -2.1+0.2*rightEyebrow); bezierVertex(0.72, -2.16+0.2*rightEyebrow, 2.4, -3.3-0.15*rightEyebrow, 4.2, -2.4-0.15*rightEyebrow); vertex(3.6, -2.46-0.15*rightEyebrow); vertex(2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); beginShape();//Left eye brow vertex(-0.72, -2.1+0.15*rightEyebrow); bezierVertex(-0.72, -2.16+0.2*rightEyebrow, -2.4, -3.3-0.15*rightEyebrow, -4.2, -2.4-0.15*rightEyebrow); vertex(-3.6, -2.46-0.15*rightEyebrow); vertex(-2.1, -2.4+0.01*rightEyebrow); endShape(CLOSE); } //Mouth Shape push(); strokeWeight(0.1); noFill() beginShape(); vertex(-1.5, 3.3 + mouthShape); bezierVertex(-0.3, 3.6 -mouthShape, 0.3, 3.6-mouthShape, 1.5, 3.3+mouthShape) endShape(); beginShape(); vertex(-0.3, 3.9+ 0.1*mouthShape); vertex(0, 3.9) vertex(0.3, 3.9+ 0.1*mouthShape); endShape(); beginShape(); noStroke() fill("#E1673D") vertex(-1.5, 3.3 + mouthShape); bezierVertex(-0.5, 3.6-mouthShape, 0.5, 3.6-mouthShape, 1.5, 3.3 + mouthShape); endShape(); pop(); //Nose Shape /* beginShape(); strokeWeight(0.1); noFill(); vertex() vertex(0.5, 2.3) bezierVertex(0.4, 2, 0.25, 2.3, 0, 2.4); vertex(-0.1, 2.4); bezierVertex(-0.25, 2.3, -0.5, 2, -0.6, 2.3); endShape(); */ push() if(decoration == 1){ //freckle fill("#B57738") noStroke() ellipse(1,0,0.1,0.1); ellipse(0.2,0.5,0.2,0.2) ellipse(-1.1,0.5,0.2,0.15); ellipse(1.4,0.8,0.15,0.15); ellipse(-1.1,0.3,0.15,0.1); ellipse(-1.4,1.3,0.15,0.15); ellipse(-0.8,0.5,0.2,0.15); ellipse(1.1,0.3,0.15,0.15); ellipse(-1,0.9,0.15,0.2); ellipse(-2,1,0.15,0.15); ellipse(2,1,0.2,0.15); ellipse(0, 1, 0.3, 0.15); ellipse(1.5, 1.4, 0.25, 0.25); ellipse(-1.8, 0.8, 0.2, 0.2); ellipse(1.8, 0.8, 0.2, 0.2); }else if(decoration==2){ //glass noFill(); strokeWeight(0.2) ellipse(2.5,0,3.5,2.5); ellipse(-2.5,0,3.5,2.5); beginShape(); vertex(0.8,0); vertex(0,-0.5) vertex(-0.8,0) endShape(); beginShape(); vertex(4.3,0); vertex(5.5,-2) endShape(); beginShape(); vertex(-4.3,0); vertex(-5.5,-2) endShape(); }else if(decoration==3){ translate(4,1) beginShape(); noStroke() fill('#EB4762') vertex(0,0); bezierVertex(0.5, -0.5, 1, 0, 0, 1); bezierVertex(-1, 0, -0.5, -0.5, 0, 0); endShape(CLOSE); } pop(); if(hairStyle == 2){ beginShape(); if(hairC == 1){ fill(h1); }else if(hairC == 2){ fill(h2); }else if(hairC == 3){ fill(h3); }else if (hairC == 4){ fill(h4); }else if(hairC == 5){ fill(h5); } vertex(0.2, -5.5); bezierVertex(0.5, -4, 0.4, -3, 0, -2) vertex(-0.5, -1); vertex(0, -1.2); vertex(-0.2, -0.5); //keep vertex(-1, 1); vertex(-0.9, 1.5);//keep bezierVertex(-0.8, 1, 0, 0, 2.5, -2); vertex(2, -1); //keep bezierVertex(3, -2, 4, -4, 4, -2); bezierVertex(3.7,-1, 4.2, -2, 4.8, 0); bezierVertex(4.5, 3, 5, 2, 5, 0); bezierVertex(6, -2, 6.5, -3, 6, -4) vertex(5.5, -5); bezierVertex(5.8, -5.2, 4, -6, 4, -6.5); bezierVertex(1, -8, 0, -8, -0.5, -7.5); vertex(-1, -8); vertex(-2, -7.5); vertex(-3, -6.5); bezierVertex(-4, -6.4, -5, -5, -5.5, -4); bezierVertex(-6, -3, -5.7, -2, -5.5, -1); vertex(-5, 1); vertex(-3.9, -2); vertex(-3, -3); vertex(-2, -4); vertex(-1.5, -3.5); vertex(-1, -4); endShape(CLOSE); }else if(hairStyle ==4){ beginShape(); if(hairC == 1){ fill(h1); }else if(hairC == 2){ fill(h2); }else if(hairC == 3){ fill(h3); }else if (hairC == 4){ fill(h4); }else if(hairC == 5){ fill(h5); } vertex(-1,-5); vertex(0,-4.8); vertex(1,-5); vertex(1.7, -6.5); vertex(1.9, -6.7); vertex(1.7, -7); vertex(1.5, -7); vertex(1.3, -7.2); vertex(1, -7.3); vertex(0.8, -7.5); vertex(0.2, -7.7); vertex(-0.2, -7.6); vertex(-1, -7.7); vertex(-2, -7.6); vertex(-4.5, -6.5); vertex(-6, -5); vertex(-6.5, -4); vertex(-6.8, -3.5); vertex(-7, -3); vertex(-6.8, -1); vertex(-6.5, 0.5); vertex(-6.5, 6); vertex(-6.8, 6.5); vertex(-7, 7.5); vertex(-6.3, 8.5); vertex(-6.6, 9); vertex(-7, 9.5); vertex(-6.5, 9.4); vertex(-6, 9); vertex(-5.8, 10); vertex(-5.5, 9.4); vertex(-5, 10); vertex(-4.8, 9); vertex(-4.5, 8); vertex(-4.3, 9); vertex(-4, 9.7); vertex(-3.5, 8.5); vertex(-2, 8); vertex(-1.5, 7.5); vertex(-1, 5); vertex(-0.7, 3); vertex(-1, 1); vertex(-0.2, -2); vertex(-1, -5); endShape(CLOSE); }else if(hairStyle ==3){ //hair Style 1 if(hairC == 1){ fill(h1); }else if(hairC == 2){ fill(h2); }else if(hairC == 3){ fill(h3); }else if (hairC == 4){ fill(h4); }else if(hairC == 5){ fill(h5); } beginShape(); vertex(0.2, -5.5); bezierVertex(1, -5.5, 1.2, -5.6, 2.5, -4); bezierVertex(3, -3, 3.5, -2.5, 4, -2.3); vertex(5, -2); vertex(5.4, -1.6); vertex(6, -2.4); bezierVertex(6.3, -2.3, 6.2, -4, 6, -5); bezierVertex(6.02, -5.5, 5.5, -6, 4.5, -7); bezierVertex(1, -8.5, 0.4, -8.2, 0, -8.3); bezierVertex(-1, -8.3, -2, -8, -2.3, -8); bezierVertex(-4, -7, -5.2 ,-6, -5.5, -5.9); bezierVertex(-5.8, -5, -6, -4, -6.5, -3); bezierVertex(-6.8, -2, -6.9, 0, -6.5, 2); bezierVertex(-6.4, 4, -6, 5, -6.1, 8); bezierVertex(-6.3, 9, -6.3, 9, -6, 9.5); vertex(-6.15, 9); vertex(-5.8, 8); vertex(-5.5, 7); vertex(-5.4, 6); vertex(-5.5, 4); vertex(-5.4, 2); vertex(-5.5, 1); endShape(CLOSE); } //reference line // line(-3,-6,3,-6);//forehead // line(-3,-2.4,3,-2.4);//eye brow // line(-1.2,2.1,1.2,2.1);//noise // line(-0.9,3.3,0.9,3.3);//mouth // line( 0, -6, 0,6);//mid line // push(); // stroke(150); // line( -1.2, -6, -1.2, 6); // line( 1.2, -6, 1.2,6); // line( 4.3, -0.9, 4.3, 0.9); // line(-4.3, -0.9, -4.3, 0.9); // pop(); pop(); noFill(); strokeWeight(0.05); beginShape(LINES); // curveVertex(positions.nose_tip[0][0], positions.nose_tip[0][1]) vertex(positions.nose_tip[0][0], positions.nose_tip[0][1]) vertex(positions.nose_tip[1][0], positions.nose_tip[1][1]) vertex(positions.nose_tip[1][0], positions.nose_tip[1][1]) vertex(positions.nose_tip[2][0], positions.nose_tip[2][1]) vertex(positions.nose_tip[2][0], positions.nose_tip[2][1]) vertex(positions.nose_tip[3][0], positions.nose_tip[3][1]) vertex(positions.nose_tip[3][0], positions.nose_tip[3][1]) vertex(positions.nose_tip[4][0], positions.nose_tip[4][1]) // curveVertex(positions.nose_tip[4][0], positions.nose_tip[4][1]) endShape(); beginShape(LINES); vertex(positions.nose_bridge[0][0], positions.nose_bridge[0][1]) vertex(positions.nose_bridge[1][0], positions.nose_bridge[1][1]) vertex(positions.nose_bridge[1][0], positions.nose_bridge[1][1]) vertex(positions.nose_bridge[2][0], positions.nose_bridge[2][1]) vertex(positions.nose_bridge[2][0], positions.nose_bridge[2][1]) vertex(positions.nose_bridge[3][0], positions.nose_bridge[3][1]) vertex(positions.nose_bridge[3][0], positions.nose_bridge[3][1]) vertex(positions.nose_tip[2][0], positions.nose_tip[2][1]) endShape(); } /* set internal properties based on list numbers 0-100 */ this.setProperties = function(settings) { this.hairStyle = int(map(settings[0], 0, 100, 1, 4)); } /* get internal properties as list of numbers 0-100 */ this.getProperties = function() { let settings = new Array(1); settings[0] = map(this.hairStyle, 1, 4, 0, 100); return settings; } } // given an array of [x,y] points, return the average function average_point(list) { var sum_x = 0; var sum_y = 0; var num_points = 0; for(var i=0; i