xxxxxxxxxx
160
function setup() {
createCanvas(500, 500);
}
function draw() {
let faceX = 250, faceY=210, faceWidth = 180, faceHeight=220;
background('#C8C7D7');
//background stripes
noStroke();
let b = true;
for(let i=0; i<500; i+=10){
for (let y=0; y<500; y+=10){
if(b==true)
{fill('#EDECF2')
b=false;}
else{
b=true;
fill('#C8C7D7');}
rect(i,y,10,10)
}
}
let c=true;
for(let i=0; i<500; i+=20){
for (let y=0; y<500; y+=20){
if(c==true)
{fill('#C8C7D7')
c=false;}
else{
b=true;
fill('#EDECF2');}
rect(i,y,10,10)
}
}
//background circles when mouse is pressed
if(mouseIsPressed){
stroke(205)
for(let i = 0; i<100; i++)
{
fill('#A89DBD')
num1= random(5);
num2 = random(5);
ellipse(mouseX*num1,mouseY*num2, 15, 15);
}
}
//hair
fill("#4d2511");
quad(150, 150, 350, 150, 400, 400, 100, 400);
fill(255, 213, 173);
quad(200, 230, 300, 230, 320, 280, 180, 280);
//face
noFill()
noStroke()
arc(250, 350, 100, 80, 0, PI);
stroke(0)
fill(252, 210, 155);
ellipse(faceX,faceY,faceWidth,faceHeight);
fill(252, 210, 155);
//neck
noStroke()
quad(220, 280, 280, 280, 300, 360, 200, 360);
//eyes
fill(255)
ellipse(215,190, 35,30 )
ellipse(285,190, 35,30)
fill(0);
ellipse(215,190, 20,25);
ellipse(285,190, 20,25);
fill(255);
//eye balls
ellipse(219,193, 8,8);
ellipse(289,193, 8,8);
//eye balls dilate when mouse is pressed
if(mouseIsPressed)
{
ellipse(219,193, 10,10);
ellipse(289,193, 10,10);
}
//nose
fill(250, 188, 130);
quad(260,250, 240,250, 250,210, 260,250);
line(260,250, 250, 210);
line(240,250, 250, 210);
line(240,250, 260,250);
//eyebrows
//eyebrows raised if mouse is pressed
if (mouseIsPressed){
fill('rgb(146,63,8)')
rect(200,150, 30,8)
rect(270,150, 30,8)
}
else{
fill('#4A2500')
rect(200,160, 30,8)
rect(270,160, 30,8)}
//hair
noStroke()
fill("#4A2500");
bezier(250,100, 50, 100, 180, 250, 100,400);
bezier(250,100, 450, 100, 320, 250, 400,400);
//lips
fill('darkred')
noFill();
//lips get bigger/smile when mouse is pressed
if (mouseIsPressed){
fill(180, 13, 61);
arc(250, 265, 50, 50, 0, PI);
}
else{
fill(180, 13, 61);
arc(250, 270, 50, 30, 0, PI);
}
//blush when mouse is pressed
if (mouseIsPressed){
fill('rgb(250,187,129)');
ellipse(200,250,25,15);
ellipse(300,250,25,15);
}
noStroke();
if(mouseIsPressed)
{ stroke(240); }
x=10
for(let i =0;i<20;i++){
fill('#D8E2EB')
ellipse(x,20,40,60);
ellipse(x,480,40,60);
ellipse(0,x,60,40);
ellipse(500,x,60,40);
x=x+30;
}
//bow on head
fill('#A89DBD')
quad(140,130, 190,170, 190,130, 140,170)
fill(120);
text('Press and move the cursor...', 10, 485);
}