xxxxxxxxxx
87
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
colorBackground();
drawArms(200,280,350,200);
drawArms(200,280,50,200);
drawBody();
drawFace();
drawGlasses();
drawEyes(10,20);
drawSmile();
drawCap();
drawPocket();
}
function colorBackground(){
//colored background
fill(120,190,255);
rect(0,0,400,350);
fill(80, 200, 10);
rect(0, 350, 400, 50);
}
function drawArms(x1,y1,x2,y2) {
//arms
strokeWeight(5);
line(x1,y1,x2,y2)
// line(250, 250, 325, 200);
// line(250, 280, 50, 200);
}
function drawBody(){
//body
fill(10, 180, 200);
strokeWeight(1);
ellipse(200, 300, 130, 250);
}
function drawFace(){
//face
fill(255);
ellipse(200, 150, 140, 150);
}
function drawGlasses(){
//glasses
fill(255);
strokeWeight(2);
circle(170, 150, 50);
circle(230, 150, 50);
line(194, 150, 206, 150);
line(134, 130, 145, 150);
line(268, 130, 255, 150);
}
function drawEyes(pupilWidth,pupilHeight) {
//eyes
fill(0);
ellipse(170, 150, pupilWidth, pupilHeight);
ellipse(230, 150, pupilWidth, pupilHeight);
}
function drawSmile(){
//smile
strokeWeight(1);
fill(150, 0, 0);
arc(200, 195, 20, 20, 0, PI);
}
function drawCap(){
//cap
strokeWeight(1);
fill(255, 120, 0);
ellipse(270, 100, 80, 20);
arc(200, 110, 120, 120, PI, 0, CHORD);
}
function drawPocket(){
//pocket
strokeWeight(1);
fill(20, 150, 200);
square(200, 250, 45, 0, 0, 10, 10);
}