Sewon Park – PO-2

sketch

// Sewon Park
// sewonp
// Section B

var eyeSize = 8;
var faceWidth = 220;
var faceHeight = 230;
var bodyc = 192;
var earc = 192;
var umbrellac = 150;


 
function setup() {
    createCanvas(600, 480);
}
 
function draw() {
    background(0);
    fill(bodyc,200,200)
    ellipse(width / 2, height / 2, faceWidth,faceHeight) // body (Gray)
    var eyeLX = width / 2 - faceWidth * 0.25;
    
    fill(255,255,255)
    var eyeRX = width / 2 + faceWidth * 0.25; 
    ellipse(eyeLX,height/2.8,eyeSize,eyeSize); // left eye
    ellipse(eyeRX,height/2.8,eyeSize,eyeSize); // right eye
    
    fill(0,0,0)
    ellipse(eyeLX,height/2.8,eyeSize/2,eyeSize/2); // left pupil
    ellipse(eyeRX,height/2.8,eyeSize/2,eyeSize/2); // right pupil
    
    fill(0,0,0)
    ellipse(width/2,height/2.6,eyeSize+1,eyeSize-3) //nose
    line(width/2,height/2.6,width/1.8,height/2.65)
    line(width/2,height/2.6,width/1.8,height/2.55)
    line(width/2,height/2.6,width/2.2,height/2.65)
    line(width/2,height/2.6,width/2.2,height/2.55) //whiskers

    fill(umbrellac,100,50)
    triangle(width/2,0,width/2.3,30,width/1.7,30)
    rect(200,30,10,140)
    arc(width/2,30,200,40,PI,0) // umbrella
    
    fill(255,250,250)
    ellipse(width/2,height/1.65,faceWidth/1.3,faceHeight/1.6) // body (White)

    fill(180,180,180)
    arc(width/2,height/2+5,eyeSize,eyeSize,0,PI) 
    arc(width/2.2,height/2+5,eyeSize,eyeSize,0,PI)
    arc(width/1.85,height/2+5,eyeSize,eyeSize,0,PI) //stomach patterns

    fill(earc,earc,255)
    triangle(width/2.5,height/3.4,width/2.4,height/6,width/2.3,height/3.4) //left ear
    triangle(width/1.8,height/3.4,width/1.7,height/6,width/1.68,height/3.4) //right ear

}
 
function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges. For example,
    // 'faceWidth' gets a random value between 75 and 150.
    faceWidth = random(200, 240); //face width changing
    faceHeight = random(230, 270); //face height changing
    eyeSize = random(5, 15); // eye size changing
    bodyc = random(100,300) //body color changing
    earc = random(100,300) //ear color changing
    umbrellac = random(0,150) // umbrella color changing 
    }

For this project, I wanted to experiment with my spirit animal Totoro. I wanted its body and umbrella to stand out, so I made the colors change with every click. Because Totoro has a leaf umbrella, I set the colors to change around green and brown.

Leave a Reply