xxxxxxxxxx
72
//Nicky, Code1,#2, 9/10/2019
function setup() {
createCanvas(400, 400);
frameRate(100);
}
function draw() {
let bg = random(0,100);
background(50);
//let faceHeight = random(height/5, height/1.5);
//let faceWidth = random(width/4, width/1.2);
let faceHeight = mouseX/1.8+20;
let faceWidth = mouseY/1.8+20;
//let faceCorner = random(height/20, height/6);
let faceCorner = mouseX/10+10;
let hairHeight = random(faceCorner, height/2-faceHeight/2);
let hairWidth = faceWidth;
let hairPositionY = (height/2-faceHeight/2-hairHeight);
let eye1PositionX = (width/2)-(faceWidth/4);
let eye2PositionX = (width/2)+(faceWidth/4);
let eyeSize = random(faceWidth/10, faceWidth/4);
let light1PositionX = eye1PositionX - eyeSize/6;
let light1PositionY = height/2 - eyeSize/6;
let light2PositionX = eye2PositionX - eyeSize/6;
let light2PositionY = height/2 - eyeSize/6;
let lightSize = eyeSize/3;
let mouthPositionX = width/2;
let mouthPositionY = height/2+faceHeight/12;
let mouthSize = random(faceHeight/6, faceHeight/6);
let mouthDegree = random(mouseX/800-0.3, mouseX/800);
//let faceColorG = random(-30, 30);
//let faceColorB = random(-50, 50);
let faceColorG = mouseX/3;
let faceColorB = mouseY/3;
//let faceShade = random(-60, 5);
let faceShade = -40;
noStroke();
//face
fill(250+faceShade,190+faceColorG+faceShade,190+faceColorB+faceShade);
rectMode(CENTER);
rect(width/2, height/2, faceWidth, faceHeight, faceCorner);
//eye1
fill(0);
ellipse(eye1PositionX, height/2, eyeSize);
//eye2
fill(0);
ellipse(eye2PositionX, height/2, eyeSize);
//light1
fill(255);
ellipse(light1PositionX, light1PositionY, lightSize);
//light2
fill(255);
ellipse(light2PositionX, light2PositionY, lightSize);
//mouth
stroke(0);
strokeWeight(2+mouseX/120+mouseY/120);
fill(250+faceShade,190+faceColorG+faceShade,190+faceColorB+faceShade);
arc(mouthPositionX, mouthPositionY, mouthSize, mouthSize, 0+mouthDegree, PI-mouthDegree);
}