|
/* |
|
* This file should contain code that draws your faces. |
|
* |
|
* Each function takes parameters and draws a face that is within |
|
* the bounding box (-10, -10) to (10, 10). |
|
* |
|
* These functions are used by your final arrangement of faces as well as the face editor. |
|
*/ |
|
|
|
|
|
function drawFace1( |
|
|
|
foundation_size_1, foundation_pos_x_1, foundation_pos_y_1, foundation_alphy_1, foundation_angle_1, |
|
foundation_size_2, foundation_pos_x_2, foundation_pos_y_2, foundation_alphy_2, foundation_angle_2, |
|
corner_type, draw_neck_or_blush, mouse_type) { |
|
|
|
|
|
let palette = [ |
|
color(247, 194, 163), |
|
color(244, 163, 160), |
|
color(246, 226, 215), |
|
color(246, 204, 180) |
|
]; |
|
|
|
|
|
let col_1 = color(244, 163, 160, foundation_alphy_1); |
|
drawFoundation( |
|
foundation_pos_x_1, foundation_pos_y_1, |
|
foundation_size_1, foundation_size_1 * 1.25, |
|
foundation_angle_1, col_1 |
|
); |
|
|
|
let col_2 = color(245, 177, 140, foundation_alphy_2); |
|
drawFoundation( |
|
foundation_pos_x_2, foundation_pos_y_2, |
|
foundation_size_2, foundation_size_2 * 1.25, |
|
foundation_angle_2, col_2 |
|
); |
|
|
|
if (draw_neck_or_blush) { |
|
drawNecklace(color(244, 146, 147)); |
|
} else { |
|
drawBlush(color(240, 159, 157)); |
|
} |
|
|
|
let col_corner = palette[3]; |
|
drawCorner(col_corner, corner_type > 3, (corner_type % 4) * HALF_PI); |
|
|
|
push(); |
|
if (mouse_type !== 0) { |
|
translate(0, 1.5); |
|
} |
|
drawMouth(mouse_type); |
|
pop(); |
|
|
|
|
|
noFill(); |
|
|
|
beginShape(); |
|
curveVertex(-9.440000, -4.280000); |
|
curveVertex(-8.600000, -5.040000); |
|
curveVertex(-6.360000, -5.560000); |
|
curveVertex(-3.800000, -5.240000); |
|
curveVertex(-1.880000, -3.280000); |
|
curveVertex(-1.600000, 1.320000); |
|
curveVertex(-1.639999, 6.119999); |
|
curveVertex(-1.639999, 7.520000); |
|
endShape(); |
|
|
|
line(-1.639999, 6.119999, 0.360001, 5.880001); |
|
|
|
beginShape(); |
|
curveVertex(-0.480000, -2.240000); |
|
curveVertex(0.120000, -4.520000); |
|
curveVertex(2.400000, -5.800000); |
|
curveVertex(4.600000, -5.680000); |
|
curveVertex(6.400000, -4.680000); |
|
curveVertex(7.760000, -2.120000); |
|
endShape(); |
|
|
|
// left eye |
|
beginShape(); |
|
curveVertex(-3.480000, -1.040000); |
|
curveVertex(-3.960000, -2.480000); |
|
curveVertex(-5.040000, -3.280000); |
|
curveVertex(-5.960000, -3.320000); |
|
curveVertex(-6.880000, -3.120000); |
|
curveVertex(-7.560000, -2.760000); |
|
curveVertex(-7.160000, -1.880000); |
|
curveVertex(-5.920000, -1.240000); |
|
curveVertex(-4.680000, -1.560000); |
|
curveVertex(-4.000000, -2.400000); |
|
curveVertex(-3.240000, -2.440000); |
|
curveVertex(0.120000, -2.960000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(-5.760000, -1.880000); |
|
curveVertex(-6.960000, -3.280000); |
|
curveVertex(-7.520000, -3.800000); |
|
curveVertex(-8.360000, -4.559999); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(-6.000000, -2.120000); |
|
curveVertex(-5.960000, -3.320000); |
|
curveVertex(-6.040000, -3.960000); |
|
curveVertex(-6.320000, -4.320000); |
|
curveVertex(-7.520000, -5.240000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(-5.640000, -2.240000); |
|
curveVertex(-5.120000, -3.280000); |
|
curveVertex(-3.880000, -4.000000); |
|
curveVertex(-2.440000, -3.920000); |
|
endShape(); |
|
|
|
// left pupil |
|
push(); |
|
beginShape(); |
|
curveVertex(-8.800000, -2.000000); |
|
curveVertex(-7.040000, -3.000000); |
|
curveVertex(-5.960000, -3.360000); |
|
curveVertex(-4.559999, -2.960000); |
|
curveVertex(-5.280000, -2.280000); |
|
curveVertex(-6.400000, -2.360000); |
|
curveVertex(-7.040000, -2.960000); |
|
curveVertex(-8.400000, -4.920000); |
|
endShape(); |
|
|
|
|
|
beginShape(); |
|
|
|
curveVertex(-7.880000, -4.480000); |
|
curveVertex(-6.800000, -2.900000); |
|
curveVertex(-6.160000, -2.540000); |
|
curveVertex(-5.460000, -2.700000); |
|
curveVertex(-4.820000, -2.720000); |
|
curveVertex(-5.100000, -2.960000); |
|
curveVertex(-5.720000, -2.800000); |
|
curveVertex(-6.400000, -3.020000); |
|
curveVertex(-5.840000, -3.080000); |
|
curveVertex(-5.340000, -3.040000); |
|
curveVertex(-6.240000, -3.220000); |
|
curveVertex(-5.280000, -5.100000); |
|
endShape(); |
|
|
|
pop(); |
|
|
|
|
|
|
|
// right eye |
|
beginShape(); |
|
curveVertex(0.280000, -1.880000); |
|
curveVertex(1.240000, -3.040000); |
|
curveVertex(3.040000, -3.720000); |
|
curveVertex(5.000000, -3.000000); |
|
curveVertex(5.679999, -1.320001); |
|
endShape(); |
|
|
|
|
|
beginShape(); |
|
curveVertex(2.320000, -6.040000); |
|
curveVertex(1.000000, -3.200000); |
|
curveVertex(2.960000, -1.960000); |
|
curveVertex(5.039999, -3.240000); |
|
curveVertex(5.880001, -6.920000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(0.360001, -2.240000); |
|
curveVertex(1.300000, -1.620000); |
|
curveVertex(1.760000, -2.300000); |
|
curveVertex(1.219999, -3.580000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(3.620000, -1.000000); |
|
curveVertex(3.099999, -1.360000); |
|
curveVertex(2.940001, -2.020000); |
|
curveVertex(3.760000, -2.960000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(5.820000, -1.780000); |
|
curveVertex(4.960001, -1.680000); |
|
curveVertex(4.119999, -2.460000); |
|
curveVertex(3.639999, -2.960000); |
|
endShape(); |
|
|
|
// right pupil |
|
beginShape(); |
|
curveVertex(4.119999, -4.800000); |
|
curveVertex(3.920000, -3.420000); |
|
curveVertex(2.960000, -2.860000); |
|
curveVertex(1.879999, -3.320000); |
|
curveVertex(1.320000, -4.240000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(2.400000, -4.360000); |
|
curveVertex(1.980000, -3.340000); |
|
curveVertex(3.059999, -2.960000); |
|
curveVertex(3.639999, -3.260000); |
|
curveVertex(3.099999, -3.500000); |
|
curveVertex(2.600000, -3.440000); |
|
curveVertex(2.560000, -3.220000); |
|
curveVertex(2.880000, -3.220000); |
|
curveVertex(3.340000, -3.320000); |
|
curveVertex(3.420000, -3.580000); |
|
endShape(); |
|
} |
|
|
|
function drawFace2( |
|
|
|
foundation_size_1, foundation_pos_x_1, foundation_pos_y_1, foundation_alphy_1, foundation_angle_1, |
|
foundation_size_2, foundation_pos_x_2, foundation_pos_y_2, foundation_alphy_2, foundation_angle_2, |
|
corner_type, draw_neck_or_blush, mouse_type) { |
|
|
|
|
|
let palette = [ |
|
color(247, 194, 163), |
|
color(244, 163, 160), |
|
color(246, 226, 215), |
|
color(246, 204, 180) |
|
]; |
|
|
|
|
|
let col_1 = color(244, 163, 160, foundation_alphy_1); |
|
drawFoundation( |
|
foundation_pos_x_1, foundation_pos_y_1, |
|
foundation_size_1, foundation_size_1 * 1.25, |
|
foundation_angle_1, col_1 |
|
); |
|
|
|
let col_2 = color(245, 177, 140, foundation_alphy_2); |
|
drawFoundation( |
|
foundation_pos_x_2, foundation_pos_y_2, |
|
foundation_size_2, foundation_size_2 * 1.25, |
|
foundation_angle_2, col_2 |
|
); |
|
|
|
if (draw_neck_or_blush) { |
|
drawNecklace(color(244, 146, 147)); |
|
} else { |
|
drawBlush(color(240, 159, 157)); |
|
} |
|
|
|
corner_type = (corner_type + 2) % 7; |
|
let col_corner = palette[3]; |
|
drawCorner(col_corner, corner_type > 3, (corner_type % 4) * HALF_PI); |
|
|
|
drawMouth(mouse_type); |
|
|
|
noFill(); |
|
|
|
// nose |
|
beginShape(); |
|
curveVertex(-3.600000, -6.360000); |
|
curveVertex(-2.440000, -4.960000); |
|
curveVertex(-3.760000, -3.440000); |
|
curveVertex(-5.660000, -3.520000); |
|
curveVertex(-6.880000, -5.080000); |
|
curveVertex(-5.800000, -6.840000); |
|
curveVertex(-3.780000, -7.480000); |
|
curveVertex(-2.080000, -6.920000); |
|
curveVertex(-0.860001, -5.140000); |
|
curveVertex(-0.840000, -2.480000); |
|
curveVertex(-2.180000, 1.420000); |
|
curveVertex(-3.340000, 3.500000); |
|
curveVertex(-3.880000, 4.040001); |
|
endShape(); |
|
|
|
line(-3.340000, 3.500000, -0.200000, 3.099999); |
|
line(-0.200000, 3.099999, -1.360000, -0.680000); |
|
|
|
push(); |
|
fill(0); |
|
ellipse(-6.880000, -3.220000, 0.4); |
|
ellipse(-5.080000, -2.720000, 0.36); |
|
noFill(); |
|
ellipse(-3.200000, -3.080000, 0.44); |
|
pop(); |
|
|
|
|
|
// right eye |
|
|
|
beginShape(); |
|
curveVertex(1.100000, -6.760000); |
|
curveVertex(1.200000, -4.860000); |
|
curveVertex(2.940001, -3.840000); |
|
curveVertex(4.559999, -4.200000); |
|
curveVertex(5.780000, -5.700000); |
|
curveVertex(5.120000, -6.980000); |
|
endShape(); |
|
|
|
push(); |
|
fill(0); |
|
ellipse(3.580000, -2.980000, 0.42, 0.35); |
|
|
|
noFill(); |
|
ellipse(1.580000, -3.260000, 0.3, 0.4); |
|
strokeWeight(0.25); |
|
ellipse(5.440001, -3.380000, 0.4); |
|
pop(); |
|
|
|
|
|
} |
|
|
|
function drawFace3( |
|
foundation_size_1, foundation_pos_x_1, foundation_pos_y_1, foundation_alphy_1, foundation_angle_1, |
|
foundation_size_2, foundation_pos_x_2, foundation_pos_y_2, foundation_alphy_2, foundation_angle_2, |
|
corner_type, draw_neck_or_blush, mouth_type) { |
|
|
|
let palette = [ |
|
color(247, 194, 163), |
|
color(244, 163, 160), |
|
color(246, 226, 215), |
|
color(246, 204, 180) |
|
]; |
|
|
|
|
|
let col_1 = color(244, 163, 160, foundation_alphy_1); |
|
drawFoundation( |
|
foundation_pos_x_1, foundation_pos_y_1, |
|
foundation_size_1, foundation_size_1 * 1.25, |
|
foundation_angle_1, col_1 |
|
); |
|
|
|
let col_2 = color(245, 177, 140, foundation_alphy_2); |
|
drawFoundation( |
|
foundation_pos_x_2, foundation_pos_y_2, |
|
foundation_size_2, foundation_size_2 * 1.25, |
|
foundation_angle_2, col_2 |
|
); |
|
|
|
if (draw_neck_or_blush) { |
|
drawNecklace(color(244, 146, 147)); |
|
} else { |
|
drawBlush(color(240, 159, 157)); |
|
} |
|
|
|
corner_type = (corner_type + 6) % 7; |
|
|
|
let col_corner = palette[3]; |
|
drawCorner(col_corner, corner_type > 3, (corner_type % 4) * HALF_PI); |
|
|
|
push(); |
|
if (mouth_type !== 2) { |
|
translate(1, 0); |
|
} |
|
drawMouth(mouth_type); |
|
pop(); |
|
|
|
|
|
noFill(); |
|
|
|
// nose |
|
beginShape(); |
|
curveVertex(-1.460000, 0.100000); |
|
curveVertex(-1.219999, 2.440000); |
|
curveVertex(-0.120000, 2.240000); |
|
curveVertex(0.280000, 0.100000); |
|
curveVertex(-0.160000, -2.760000); |
|
curveVertex(0.580000, -5.780000); |
|
curveVertex(2.640000, -7.780000); |
|
curveVertex(5.000000, -7.960000); |
|
curveVertex(7.180000, -6.140000); |
|
curveVertex(7.900000, -3.840000); |
|
curveVertex(7.400000, -0.320000); |
|
curveVertex(5.500000, 3.719999); |
|
curveVertex(3.220000, 6.240000); |
|
curveVertex(0.260000, 7.219999); |
|
curveVertex(-2.480000, 6.380001); |
|
curveVertex(-4.780000, 3.760000); |
|
curveVertex(-5.660000, 0.180000); |
|
curveVertex(-5.500000, -2.059999); |
|
curveVertex(-4.000000, -3.740000); |
|
endShape(); |
|
|
|
|
|
// left eye |
|
beginShape(); |
|
curveVertex(-7.000000, -0.620000); |
|
curveVertex(-7.520000, -2.540000); |
|
curveVertex(-4.980000, -3.760000); |
|
curveVertex(-2.460000, -2.560000); |
|
curveVertex(-4.080000, -0.059999); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(-6.780000, -4.720000); |
|
curveVertex(-7.680000, -2.560000); |
|
curveVertex(-5.080000, -1.280001); |
|
curveVertex(-2.340000, -2.440000); |
|
curveVertex(-2.540000, -5.080000); |
|
endShape(); |
|
|
|
|
|
|
|
// tears |
|
push(); |
|
fill(0); |
|
ellipse(-8.300000, -1.620000, 0.32); |
|
ellipse(-8.400000, 0.320000, 0.32, 0.44); |
|
strokeWeight(0.25); |
|
ellipse(-8.500000, 1.700000, 0.26, 0.42); |
|
pop(); |
|
|
|
|
|
// left pupil |
|
push(); |
|
ellipse(-4.960000, -2.460000, 1.4); |
|
|
|
strokeWeight(0.2); |
|
|
|
beginShape(); |
|
curveVertex(-6.020000, -2.280000); |
|
curveVertex(-5.420000, -2.220000); |
|
curveVertex(-4.880000, -2.440000); |
|
curveVertex(-4.920000, -3.020000); |
|
curveVertex(-4.420000, -2.620000); |
|
curveVertex(-4.520000, -2.240000); |
|
curveVertex(-4.740000, -1.960000); |
|
curveVertex(-5.240000, -2.140000); |
|
curveVertex(-4.580000, -2.640000); |
|
curveVertex(-4.700000, -2.180000); |
|
curveVertex(-5.040000, -2.140000); |
|
curveVertex(-4.620000, -2.700000); |
|
curveVertex(-4.420000, -6.900000); |
|
endShape(); |
|
|
|
|
|
|
|
pop(); |
|
|
|
|
|
|
|
// right eye |
|
beginShape(); |
|
curveVertex(1.940001, -4.880000); |
|
curveVertex(2.000000, -3.220000); |
|
curveVertex(3.940001, -2.720000); |
|
curveVertex(5.840000, -3.700000); |
|
curveVertex(4.759999, -5.020000); |
|
endShape(); |
|
|
|
line(2.660000, -2.860000, 2.420000, -2.000000); |
|
line(3.719999, -2.720000, 3.960000, -1.940001); |
|
line(4.720000, -2.900000, 5.780000, -1.219999); |
|
|
|
|
|
} |
|
|
|
// draw foundation |
|
// x, y : position |
|
// w, h : size |
|
function drawFoundation(x, y, w, h, angle, col) { |
|
push(); |
|
translate(x, y); |
|
rotate(angle); |
|
|
|
noStroke(); |
|
fill(col); |
|
ellipse(0, 0, w, h); |
|
pop(); |
|
} |
|
|
|
// draw corner decoration |
|
// col color |
|
// type circle or rectangle |
|
// angle |
|
function drawCorner(col, type = true, angle = 0) { |
|
push(); |
|
noStroke(); |
|
fill(col); |
|
|
|
angleMode(RADIANS); |
|
rotate(angle); |
|
|
|
if (type) { |
|
beginShape(); |
|
curveVertex(-2.200000, -9.040000); |
|
curveVertex(1.300000, -9.560000); |
|
curveVertex(3.680000, -9.240000); |
|
curveVertex(7.600000, -9.160000); |
|
curveVertex(8.600000, -9.040000); |
|
curveVertex(8.520000, -6.100000); |
|
curveVertex(8.500000, -2.860000); |
|
curveVertex(8.420000, -0.840000); |
|
curveVertex(7.879999, -2.880000); |
|
curveVertex(6.740000, -5.340000); |
|
curveVertex(5.100000, -7.280000); |
|
curveVertex(3.520000, -8.480000); |
|
curveVertex(1.240000, -9.560000); |
|
curveVertex(2.680000, -6.820000); |
|
endShape(); |
|
} else { |
|
arc(-8, -8, 7, 6, PI, TWO_PI); |
|
} |
|
|
|
pop(); |
|
} |
|
|
|
// draw necklace |
|
// col color |
|
function drawNecklace(col) { |
|
push(); |
|
translate(0, 1.5); |
|
noFill(); |
|
stroke(col); |
|
beginShape(); |
|
curveVertex(6.820000, 5.800000); |
|
curveVertex(7.940001, 7.520000); |
|
curveVertex(5.580000, 9.620001); |
|
curveVertex(1.280001, 8.020000); |
|
curveVertex(-2.540000, 9.500000); |
|
curveVertex(-4.940000, 7.780001); |
|
curveVertex(-6.940000, 8.600000); |
|
curveVertex(-6.060000, 9.719999); |
|
endShape(); |
|
pop(); |
|
} |
|
|
|
// draw blush |
|
// col color |
|
function drawBlush(col) { |
|
push(); |
|
stroke(250); |
|
strokeWeight(0.1); |
|
fill(col); |
|
ellipse(2.240000, 0.520000, 1, 2.5); |
|
pop(); |
|
} |
|
|
|
//draw mouth |
|
function drawMouth(type = 0) { |
|
push(); |
|
noFill(); |
|
strokeWeight(0.2); |
|
stroke(0); |
|
|
|
if (type === 0) { |
|
beginShape(); |
|
curveVertex(-4.960000, 4.960001); |
|
curveVertex(-3.320000, 6.559999); |
|
curveVertex(-1.520000, 7.200001); |
|
curveVertex(0.480000, 6.959999); |
|
curveVertex(1.640000, 6.160000); |
|
curveVertex(1.920000, 7.560001); |
|
curveVertex(1.000000, 8.600000); |
|
curveVertex(-0.760000, 8.719999); |
|
curveVertex(-2.360000, 8.160000); |
|
curveVertex(-3.600000, 6.559999); |
|
curveVertex(-3.200000, 4.080000); |
|
endShape(); |
|
} else if (type === 1) { |
|
rect(-4.240000, 4.880000, 6, 2.5) |
|
} else if (type === 2) { |
|
beginShape(); |
|
curveVertex(-1.340000, 8.719999); |
|
curveVertex(-2.220000, 7.820000); |
|
curveVertex(0.000000, 5.900001); |
|
curveVertex(2.200001, 6.020000); |
|
curveVertex(3.580000, 7.940001); |
|
curveVertex(1.700000, 8.820000); |
|
endShape(); |
|
|
|
beginShape(); |
|
curveVertex(-2.620000, 9.559999); |
|
curveVertex(-2.320000, 8.099998); |
|
curveVertex(3.540000, 7.719999); |
|
curveVertex(4.220000, 9.580000); |
|
endShape(); |
|
} |
|
|
|
|
|
pop(); |
|
} |