Lanna Lang – Project 02 – Variable Face

lanna_project02_sketch

//Lanna Lang
//Section D
//lannal@andrew.cmu.edu
// Project 02 Variable Face

var fill1 = '#00bff3'
var r = 255
var g = 245
var b = 104
var duckoWidth = 500
var duckoHeight = 600
var thic = 20
var mouthWidth = 70
var eyeSize = 20
var blushX = 80
var blushY = 470


function setup() {
    createCanvas(480, 640);
}

function draw() {
    background(fill1);
    
//lefthair
    strokeWeight(thic);
    stroke(0);
    line(240, 250, 170, 150);

//righthair
    strokeWeight(thic);
    stroke(0);
    line(240, 250, 310, 150);

//body
    fill(r, g, b);
    ellipse(240, 550, duckoWidth, duckoHeight);

//eyes
    fill(0);
    circle(140, 390, eyeSize);
    circle(340, 390, eyeSize);

//mouth
    strokeWeight(mouthWidth);
    stroke('#f49ac1');
    line(200, 500, 280, 500);

//blush lines on the left
    strokeWeight(10);
    stroke('#f69679');
    line(blushX - 20, blushY, blushX, blushY + 30);
    line(blushX, blushY, blushX + 20, blushY + 30);
    line(blushX + 20, blushY, blushX + 40, blushY + 30);
  
//blush lines on the right
    strokeWeight(10);
    stroke('#f69679');
    line(blushX + 300, blushY, blushX + 320, blushY + 30);
    line(blushX + 320, blushY, blushX + 340, blushY + 30);
    line(blushX + 340, blushY, blushX + 360, blushY + 30);
}

function mousePressed() {
    g = random(200, 255);
    duckoWidth = random(100, 900);
    mouthWidth = random(30, 200);
    eyeSize = random(5, 150);
}

I experimented with different faces and making different characters, but I enjoyed the result of coding this character, so this became my final outcome. The code behind the character is simple, but after experimenting with p5js and creating characters for a while, I decided that sometimes less is more.

Leave a Reply