/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://accdf12.sketchpad.cc/sp/pad/view/ro.89MFz72HG5r/rev.8
*
* authors:
* Michael Kontopoulos
* Benjamin
* Siyun Oh
* Dansun Hwang
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
/* 2. Re-drawing the same face, but now some widths, heights and positions are based
* on a variable called v, which I initialized to 100 for simplicity.
* It helps to think of things in terms of percentages sometimes, e.g. 20 becomes 100 * 0.20
*
* M. Kontopoulos, 2012
*/
void setup() {
size(500, 500);
smooth();
}
void draw() {
background(255);
//Hooking v up to mouseX is more extensible becuase
//when we want to change from mouseX to mic input, we only have to change it once here.
float v = mouseX / 2.0;
noStroke();
fill(0);
ellipse(170, 150, v/2.0, v/2.0);
ellipse(330, 150, v/2.0, v/2.0);
stroke(255);
noFill();
ellipse(170, 150, v*0.2, v*0.2); //v controls all the pupil, eye and highlight sizes
ellipse(330, 150, v*0.2, v*0.2);
fill(255);
ellipse(180, 140, v*0.12, v*0.12);
ellipse(340, 140, v*0.12, v*0.12);
fill(40);
arc(250, 250, 400, v, 0, PI); //v controls the hight of the arc now.
stroke(50);
for (int i=0; i<250; i+=10)
{
line(i, -10, i-(v*0.3), 50); //v controls the offset of the hair, in both directions
}
for (int i=250; i<500; i+=10)
{
line(i, -10, i+(v*0.3), 50);
}
}