lmattson-02-project
//Luke Mattson
//section A
var w= 600
var h= 480
var headradius= w/3
var eyeRadius= headradius/4
var smileSize=.5
var skinR=255
var skinG=255
var skinB=255
var skin=1
function setup() {
createCanvas(w, h);
}
function draw() {
background(128,206,225); // background
fill(167,199,231);
strokeWeight(1);
stroke(140,170,220);
triangle(0,0,600,600,0,600);
//hair based on size of face
stroke(0);
fill(223,180,130);
ellipse(w/2,h/2-50,headradius,headradius*1.4);
//ears attached to face with 3 color possibilities
if (skin==1) {
fill(255,219,172)
} else if (skin==2) {
fill(224,172,105)
} else {
fill(241,194,125)
}
ellipse(w/2-headradius/2,230,30,60);
ellipse(w/2+headradius/2,230,30,60);
//random size face with 3 color possibilities
if (skin==1) {
fill(255,219,172)
} else if (skin==2) {
fill(224,172,105)
} else {
fill(241,194,125)
}
ellipse(w/2,h/2,headradius,headradius*1.4);
//random size eyes
fill(245,245,245);
stroke(0);
strokeWeight(1.5);
circle(w/2-headradius/5,h/2-headradius/5,eyeRadius)
circle(w/2+headradius/5,h/2-headradius/5,eyeRadius)
fill(0,0,200,30);
circle(w/2-headradius/5,h/2-headradius/5,eyeRadius/3)
circle(w/2+headradius/5,h/2-headradius/5,eyeRadius/3)
//random size mouth
stroke(249,21,21)
strokeWeight(1)
fill(255,127,127)
arc(w/2,headradius/5+h/2,150,80, smileSize, PI, OPEN)
//nose
stroke(0)
strokeWeight(.5)
line(300,240,290,275);
line(310, 280,290, 275);
//body attached to bottom of face
var bodyx = w/2
var bodyy = h/2 + .5*(headradius*1.4)
stroke(255,255,255);
strokeWeight(1.5)
line(bodyx,bodyy, bodyx, bodyy+40);
line(bodyx,bodyy+40,bodyx+10,bodyy+50)
line(bodyx,bodyy+40,bodyx-10,bodyy+50);
line(bodyx,bodyy+20,bodyx+10,bodyy+10)
line(bodyx,bodyy+20,bodyx-10,bodyy+10)
}
//assign random variables
function mousePressed() {
headradius= random(.4,.7)*h
eyeRadius= random(headradius/8,headradius/4)
skin = int(random(0,3))
smileSize=random(0,1)
}