xxxxxxxxxx
function setup() {
background('black');
createCanvas(windowWidth, windowHeight);
loc_x = windowWidth/2;
loc_y = windowHeight/2;
}
function draw() {
createCanvas(windowWidth, windowHeight);
fill('white');
textSize(20);
text("Click to get a hat", 100, 100);
x = mouseX;
y = mouseY;
loc_x = loc_x + ((x-loc_x)/100);
loc_y = loc_y + ((y-loc_y)/100);
//HEAD
noStroke();
fill(230, 210, 190);
ellipse(loc_x,loc_y,300, 300);
//EYE WHITE1
noStroke();
fill(255)
ellipse(loc_x-60,loc_y,70,50)
//EYE WHITE2
noStroke();
fill(255)
ellipse(loc_x+60,loc_y,70,50)
//PUPIL RIGHT
fill (50, 50, 50);
strokeWeight(10);
stroke(150, 150, 200);
ellipse(loc_x-60+x/100,loc_y+y/60,20,20);
//PUPIL LEFT
fill (50, 50, 50);
strokeWeight(10);
stroke(150, 150, 200);
ellipse(loc_x+60+x/100,loc_y+y/60,20,20);
if (mouseIsPressed) {
//HAT
noStroke();
fill (50, 50, 50);
square(loc_x-150,loc_y-380,300,300);
//HAT2
fill (70,70,70);
rect(loc_x-220,loc_y-110, 450, 30);
}
}