SiminLi Project 2

siminliproject02

// Simin Li
// Section C
// siminl@andrew.cmu.edu
// Project 02
var eyeSize = 20;
var faceWidth = 222;
var faceHeight = 260;
var a = 180;
var b = 160; //coordinates of drop 2
var k = 8; //size of drop 2
var i = 0;
var c = 175;
var d = 163;//coordinates of drop 1
var m = 18; //size of drop 1
var j = 0;
var noseHeight = 40;
var rd = 171;
var gn = 31;
var bl = 31;// RGB of lip color

function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background(193,222,239); //blue
    noStroke();
    
    fill(248,213,178); // arm
    triangle(0, 300, 0, 0, 550 ,0)
    
    fill(240,174,164); //mosquito bite
    ellipse( 150, 120, 30,  50); 
    fill(249,223,213 ); 
    ellipse( 150, 120, 6,  6); 

    fill(240,174,164); //mosquito bite
    ellipse( 300, 70, 40,  20); 
    fill(249,223,213 ); 
    ellipse( 299, 70, 6,  6); 

var noseY = height / 2 - noseHeight; //y of nose bridge point
var noseX = width / 2 - faceWidth * 0.5 - noseHeight * 0.3; //x ofnose tip
var nosey = height / 2 - faceHeight / 3; //y of nose tip
    fill(254,242,195 ); 
    triangle(noseX,nosey, width / 2, height / 2 - faceHeight / 2, width / 2, noseY);//nose
    
    ellipse(width / 2, height / 2, faceWidth,  faceHeight); //face 

var eyeRX = width / 2 + faceWidth * 0.25; //positions the mouth
   
    fill(0) ; // eye liner
    arc(eyeRX, height / 2 - 30 , eyeSize + 17, eyeSize + 17,PI ,TWO_PI,CHORD);
    noStroke();
    fill(252,253,255)   ; // eye whites
    ellipse(eyeRX, height / 2 - 30, eyeSize, eyeSize);
    fill(0) ; // pupil
    arc(eyeRX, height / 2 - 30, eyeSize - 15, eyeSize - 15, QUARTER_PI,TWO_PI,PIE);
    

var mouthWidth = width / 2 - faceWidth * 0.25; //positions the mouth
    stroke(rd,gn,bl);
    strokeWeight(15.0);
    fill(228,95,136 )   ; //mouth
    ellipse(mouthWidth,height / 2 + 15,faceHeight / 4,faceWidth / 4);

    noStroke();          //blood drop 1
    fill(225,39,39);
    beginShape();
    curveVertex(c,  d);
    curveVertex(c + (1 / 2) * m,  d + m * 2);
    curveVertex(c + (3 / 4) * m,  d + m * 3);
    curveVertex(c,  d + 4 * m);
    curveVertex(c - (3 / 4) * m,  d + m * 3);
    curveVertex(c - (1 / 2) * m,  d + m * 2);
    endShape(CLOSE);
    d = d + 2.5; 
    j ++;  // so drop can return to origin
    if ( d > 420)
    { d = d - j * 2.5; 
        j = 0; }

    noStroke(); //(dark) blood drop 2
    fill(138,24,24);
    beginShape();
    curveVertex(a,  b);
    curveVertex(a + (1 / 2) * k,  b + k * 2);
    curveVertex(a + (3 / 4) * k,  b + k * 3);
    curveVertex(a,  b + 4 * k);
    curveVertex(a - (3 / 4) * k,  b + k * 3);
    curveVertex(a - (1 / 2) * k,  b + k * 2);
    curveVertex(a,  b);
    endShape(CLOSE);
    b = b + 2.9; 
    i ++; // so drop can return to origin
    if ( b > 420)
    { b = b - i * 2.9; 
        i = 0; }

    fill(0);
    text("this mosquito is hungry for blood..", 410, 465);
}
 
function mousePressed() {

    faceWidth = random(200, 300); //changes the shape of the face 
    faceHeight = random(200, 300);
    eyeSize = random( 12, 60); 
    noseHeight = random(30, faceHeight / 2 ); 
    rd = random(0, 255);
    gn = random(0, 255);
    bl = random(0, 255);
}

This project turned out very different from what I originally planned. I wanted to make a person with a nosebleed and when I got to making the nose, the pointy quality of it inspired me to make a mosquito sucking blood. I am very happy with my decision.

Leave a Reply