xxxxxxxxxx
102
// Connie Hu
// Code! 2 - assignment 1
let right_eye
let left_eye
// Gravity for bouncing heads
let gravity = 0.1;
// preload images
function preload(){
lemon = loadImage('images/lemon.png');
headbang = loadImage('images/beavis_butthead.gif');
bababa = loadImage('images/king_of_the_hill.gif');
doraemon_nose = loadImage('images/doraemon.png');
notepad = loadImage('images/notepad_blues_clues.png');
}
// setup
function setup() {
createCanvas(400, 450);
//frameRate(22)
//createLoop({duration:15,gif:true})
//saveFrames("self_portrait","png",15,22);
//create new instances of objects according to classes/blueprints - in sepparate files
left_eye = new Eye (145, 170, 75, 75);
right_eye = new Eye (255, 170, 75, 75);
bouncing_head = new Bounce(60, 0, 50, 50)
}
// draw function, continuously reloads
function draw() {
background(185, 255, 79);
image(bababa, -30, 0, 220, 195 ) // top left corner
// body/yellow shirt
strokeWeight(2);
stroke(0);
fill(247, 189, 86); // shirt color
rect(40, 320, 300, 200, 20);
// outline/stroke and fill color for face and arms
stroke(209, 173, 140);
strokeWeight(2);
fill(241, 202, 161);
// arm holding notepad
rect(320, 300, 60, 200, 10); // arm
image(notepad, 300, 210, 100,100)
// face
ellipse(200, 200, 230, 280);
// glasses
// lenses
stroke(71, 58, 99);
strokeWeight(5);
fill(111, 231, 215);
ellipse(255, 80, 90, 85);
ellipse(155, 80, 90, 85);
//connector
stroke(14, 52, 76);
strokeWeight(2);
fill(188, 140, 226);
rect(185, 60, 40, 10, 20);
// Nose - Doraemon's Head
image(doraemon_nose, 185, 205, 35, 35)
// Mouth - a bit conveluted but I like how it looks. I drew inspiration from my frog last semester, but personalized it to be proportional to my self portrait face
stroke(0);
strokeWeight(5);
line(165, 267, 235, 267);
noStroke();
fill(255, 92, 92); // tongue color red
arc(210, 269, 30, 50, 0, PI, CHORD);
// shirt design
// BEAVIS AND BUTTHEAD HAHAHAHHHAHHAHAHAHAHA
image(headbang, 145, 345, 120, 95)
// make eyes appear
// class in sepparate folder called 'eye'
left_eye.show();
right_eye.show();
// make bouncing doraemon appear and update according to class instructions
// class in sepparate folder called 'bounce'
bouncing_head.display();
bouncing_head.update();
}