Isabelle Vincent Project-02

sketch

var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var earWidth = 10;
var earHeight = 10;
var FacecolorPt1 = 100;
var FacecolorPt2 = 100;
var FacecolorPt3 = 100;
var StrokecolorPt1 = 0;
var StrokecolorPt2 = 0;
var StrokecolorPt3 = 0;
var thic = 1;
var y1 = 220;
var y2 = 260;
function setup() {
    createCanvas(640, 480);
}

function draw() {
    background(51, 153, 102);
    //body
    fill(0);
    stroke(0);
    triangle(320 - faceWidth/2 - 40 , 480 , 320 , 240 , 320 + faceWidth/2 + 40,480);
    //face elliplse
    fill(FacecolorPt1, FacecolorPt2, FacecolorPt3);
    stroke(StrokecolorPt1, StrokecolorPt2, StrokecolorPt3);
    ellipseMode(CENTER);
    ellipse(320, 240, faceWidth,  faceHeight);
    //eye ellilpse
    fill(0);
    var eyeLeftX = width / 2 - faceWidth * 0.25;
    var eyeRightX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLeftX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRightX, height / 2, eyeSize, eyeSize);
    //nose
    stroke(0);
    strokeWeight(thic);
    line(320,y1,320,y2);
    //hat
    triangle(320 - faceWidth/2 , 240 - faceHeight/2, 320, 0, 320 + faceWidth/2, 240 - faceHeight/2);
    rectMode(CORNERS);
    rect(320 - faceWidth/2 - 30, 240 - faceHeight/2 - 20, 320 + faceWidth/2 + 30, 240 - faceHeight/2 + 20);
    //Cauldron
    stroke(0);
    strokeWeight(5);
    fill(0);
    ellipseMode(CORNER);
    ellipse(10,430,50,50);
    rectMode(CORNER);
    rect(5,425,60,20);
    //Cursor Egg
    fill(255);
    strokeWeight(3);
    stroke(255);
    ellipse(mouseX,mouseY,20,30);
}

function mousePressed() {
    faceWidth = random(50, 400);
    faceHeight = random(100, 340);
    eyeSize = random(10, 30);
    earHeight = random(10,25);
    FacecolorPt1 = random(10,255);
    FacecolorPt2 = random(10,255);
    FacecolorPt3 = random(10,255);
    StrokecolorPt1 = random(0,255);
    StrokecolorPt2 = random(0,255);
    StrokecolorPt3 = random(0,255);
    thic = random(1,10);
    y1 = random(240 - eyeSize, 240 - eyeSize);
    y2 = random(y1 + 5,y1 + 30);
}

I used the given template as my basis; I changed some of the original framework and built on top of it. After randomizing the skin color I decided to make the faces into witches because most of the randomized skin colors look non-human and similar to a cartoon witch.

Leave a Reply