xxxxxxxxxx
131
function background_details() {// adding some fun background elements in the portrait in the style of Joan Miro
fill(255, 99, 71);
ellipse(150, 150, 200, 300); //red ellipse in the top left
fill(255, 215, 0);
rect(600, 100, 150, 150, 30); //yellow rounded rectangle in the top left of the portrait
//drawing the gold star within the yellow rectangle
fill(255, 255, 0);
noStroke();
beginShape();
vertex(650, 150);
vertex(660, 180);
vertex(690, 180);
vertex(665, 200);
vertex(675, 230);
vertex(650, 210);
vertex(625, 230);
vertex(635, 200);
vertex(610, 180);
vertex(640, 180);
endShape(CLOSE);//close used in endshape to connect first and last vertex
//defines stroke color and thickness for the portrait
stroke(0);
strokeWeight(4);
noFill();
beginShape();
vertex(100, 300);
bezierVertex(200, 400, 400, 100, 600, 300);//curved line on top of the eyebrows to add more details
endShape();
}
function face() {
// drawing the pentagonal shape for the shape using vectors as the shape is not uniform
fill(255, 235, 205);
beginShape();
vertex(300, 400);
vertex(500, 350);
vertex(650, 450);
vertex(550, 650);
vertex(350, 600);
endShape(CLOSE);
//drawing the circular nose shape
fill(0, 191, 255);
ellipse(470, 530, 80, 80);
}
function eyes() {
// drawing the white of the eyes
fill(255);
ellipse(350, 450, 100, 50); // left eye
ellipse(550, 450, 50, 100); // right eye
fill(0);
ellipse(350, 450, 30, 30); // left pupil
ellipse(550, 450, 30, 30); // right pupil
//colorful ellipses surrounding the eyes
noFill();
stroke(255, 99, 71);
strokeWeight(6);
ellipse(350, 450, 120, 70);
stroke(0, 191, 255);
ellipse(550, 450, 70, 120);
}
function details() {
fill(255,255,0);//drawing a crescent moon shape by drawing two intersecting circles and having one of them be the color of the background
//this effect makes it so that the second circle cuts the first one to make the moon shape
noStroke();
ellipse(150,630,100,100);
fill(240, 248, 255);
ellipse(170,630,100,100);
//drawing the diagonal lines for the eyebrows
stroke(0);
strokeWeight(4);
line(300, 300, 450, 400);
line(500, 400, 650, 300);
//drawing the yellow curve around the mouth
noFill();
stroke(255, 215, 0);
strokeWeight(8);
beginShape();
vertex(250, 550);
bezierVertex(350, 500, 450, 700, 550, 550);
endShape();
}
function fun_elements() {
fill(0, 255, 127); // green circle in bottom left
ellipse(150,730, 80, 80);
fill(255, 105, 180); // pink triangle within the red ellipse
triangle(100, 100, 150, 50, 200, 100);
//adding fun curves around the whole portrait to further exemplify Miro's style
stroke(0);
strokeWeight(5);
noFill();
beginShape();
vertex(700, 300);
bezierVertex(600, 400, 500, 200, 400, 300);
endShape();
beginShape();
vertex(150, 550);
bezierVertex(250, 500, 350, 700, 450, 550);
endShape();
}
function setup() {
createCanvas(800, 800);
background(240, 248, 255); //light background to make colors pop
noLoop();
}
function draw() {
background_details();
face();
eyes();
details();
fun_elements();
}