Lydia Jin Project-02-Variable Face

sketch


var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var mouthsize=30;
var nosesize=20;
var eyecolor=0;
var colorR=20;
var colorG=20;
var colorB=20;
var light1=20;
var light1X=10;
var light1Y=10;
var light2=50;
var light2X=250;
var light2Y=20;
var light3=100;
var light3X=400;
var light3Y=300;

function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background(colorR,colorG,colorB);
    fill(243,215,198);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    //face
    fill(0);
    rect(width/2-15,height/2-faceHeight/2,30,40);
    //hair
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill(eyecolor);
    ellipse(eyeLX, height / 2-15, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2-15, eyeSize, eyeSize);
    //eyes\
    fill(247,196,152);
    ellipse(width/2,height/2,eyeSize-5,eyeSize+5);
    //nose
    fill(232,0,0);
    ellipse(width/2,height/2+50,nosesize,nosesize);
    //mouth
    fill(200);
    rect(width/2-faceWidth/2,height/2+faceHeight/2,faceWidth,200);
    //shirt (body)
    fill(163,98,81);
    ellipse(width/2,height/2+faceHeight/2+50,10);
    ellipse(width/2,height/2+faceHeight/2+100,10);
    //buttons
    fill(255,colorR,colorG,colorB);
    ellipse(light1X,light1Y,light1);
    ellipse(light2X,light2Y,light2);
    ellipse(light3X,light3Y,light3);
    //party lights

}
 
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(100, 200);
    faceHeight = random(150, 200);
    eyeSize = random(10, 30);
    mouthsize=random(10,50);
    nosesize=random(10,30);
    eyecolor=random(0,150);
    colorR=random(0,255);
    colorG=random(0,255);
    colorB=random(0,255);
    light1=random(0,200);
    light2=random(100,200);
    light3=random(0,80);
    light1X=random(0,50);
    light1Y=random(0,480);
    light2X=random(400,600);
    light2Y=random(0,480);
    light3X=random(420,600);
    light3Y=random(200,480)
}

This is Sushi Head Man at a party.

Leave a Reply