xxxxxxxxxx
78
function setup() {
createCanvas(500, 500);
}
function mousePressed() {
save("htet_SelfPortrait.jpg");
}
function draw() {
background("rgb(226,96,125)");
strokeWeight(3);
var x = mouseX; //160
var y = mouseY; //185
//hair
fill("rgb(95,188,210)");
quad(x + 40, y - 155, x + 80, y - 155, x + 70, y - 85, x + 40, y - 85);
fill("rgb(15,149,180)");
arc(x + 40, y - 85, 100, 140, PI, PI + HALF_PI);
fill("rgb(241,193,158)");
// face
rect(x - 60, y - 85, 200, 210, 60);
fill("rgb(226,181,148)");
rect(x - 80, y - 5, 20, 50, 10, 3, 3, 10);
rect(x + 140, y - 5, 20, 50, 3, 10, 10, 3);
noFill();
//glasses
rect(x - 30, y - 25, 60, 50, 15, 20, 30, 40);
rect(x + 50, y - 25, 60, 50, 20, 15, 40, 30);
line(x - 60, y - 5, x - 30, y - 5);
line(x + 110, y - 5, x + 140, y - 5);
arc(x + 40, y - 5, 20, 20, PI, TWO_PI, OPEN);
fill("black");
//eyes
circle(x, y, 20);
circle(x + 80, y, 20);
//nose
line(x + 50, y + 5, x + 60, y + 55);
line(x + 30, y + 55, x + 60, y + 55);
noFill();
//mouth
arc(x + 30, y + 55, 60, 60, HALF_PI, PI);
//body
fill("rgb(245,90,3)");
rect(70, 320, 260, 190, 50, 50, 0, 0);
//neck
fill("rgb(253,194,151)");
arc(x + 40, y + 125, 50, 50, 0, PI);
//handcollars
fill("rgb(245,90,3)");
rect(60, 400, 80, 30);
fill("rgb(245,90,3)");
rect(260, 400, 80, 30);
//hands
fill("rgb(253,194,151)");
rect(70, 430, 50, 100);
rect(280, 430, 50, 100);
//text
textSize(x + 0.000001);
fill(0);
textStyle(BOLDITALIC);
text("Hi", x + 210, y + 65);
}
var y = 250;
console.log(y - 185);