xxxxxxxxxx
75
function setup() {
createCanvas(400, 400);
pixelDensity(1);
frameRate(1);
}
function draw() {
background(220);
// To make a character generator based on my style
faceWidth = random(80,200);
faceHeight = random(120,200);
eyeSpace = random(35,40);
noseHigh = random (40,70);
noseSize = random(20,50);
facepinW = width/2 - faceWidth/2;
facepinH = height/2 - faceHeight/2;
strokeWeight(4);
// To do look in to merging shapes for silhouette stroke afterwards
//nose
stroke(0);
strokeJoin(ROUND);
fill(0);
triangle(facepinW+3, facepinH+eyeSpace, facepinW+3, facepinH+eyeSpace+noseHigh, facepinW -noseSize, facepinH+eyeSpace+noseHigh);
//Face
fill(0);
noStroke();
rectMode(CENTER);
rect(width/2,height/2,faceWidth,faceHeight,0,faceWidth/4,0,20);
//eye
noStroke();
fill(255);
ellipse(facepinW+eyeSpace, facepinH+eyeSpace, 40, 18);
fill(0);
ellipse(facepinW+eyeSpace, facepinH+eyeSpace, 12, 12);
//mouth
stroke(220);
noFill();
//top lip
//arc(facepinW, height/2 + faceHeight/2*.6, 100, 0, 180, 0, OPEN);
//bottom lip
arc(facepinW, height/2 + faceHeight/2*.6, random(50,100), random(0,50), 0, 90, OPEN);
//ear
stroke(255);
noFill();
arc(facepinW+faceWidth*.75, facepinH+eyeSpace*2, random(10,40), random(20,70), 180, 90, OPEN);
//neck
fill(0);
noStroke();
rect(width/2+faceWidth/4,height/2+faceHeight-4,faceWidth/2,faceHeight);
//noLoop();
}
function mouseClicked() {
redraw();
}