/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://bard117s14.sketchpad.cc/sp/pad/view/ro.E0gIBLFzuTX/rev.2
*
* authors:
* Reeves Morris-Stan
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// This sketch builds on a prior work, "Self Portrait II", created by Keith O'Hara
// http://bard117s14.sketchpad.cc/sp/pad/view/ro.AfNeVls4vddifn/rev.71
/* Reeves Morris-Stan
* 2-18-14
* [email protected]
* The idea of this self portrait was to explore creating some very basic
* conditionals in hope of becoming more familiar witht them. This disco
* head reaches maximum disco potential when your mouse is on the left side
* of the screen and you are holding down a key.
*
* NOTE: Some of this code is taken from Keith O'Hara's "Conditionals" sketch.
* It is noted in the code where this occurs.
*/
int i = 0;
void setup() {
size(640, 640);
smooth();
background(140, 140, 140);
}
//clear the background
void keyPressed() {
background(140, 140, 140);
}
//Self portrait
void draw() {
rectMode(CENTER);
//Head
fill(216, 171, 122);
rect(320, 280, 160, 170);
//Glasses
fill(126, 176, 245, 230);
rect(285, 255, 55, 35);
rect(355, 255, 55, 35);
fill(80, 49, 49);
rect(320, 252, 15, 5);
rect(249, 252, 16, 10);
rect(391, 252, 17, 10);
//Nose
fill(216, 171, 122);
ellipse(320, 295, 20, 7);
//Mouth
fill(234, 149, 155);
rect(320, 330, 40, 10);
//Disco Lines
//following code was taken from Keith O'Hara's Sketch "Conditionals"
// set the color
stroke(random(50), random(255), random(255), 100);
// draw the line
line(i, 0, random(0, width), height);
// move over a pixel
if (i < width) {
i++;
}
else {
i = 0;
}
//end of Keith's code
//outline the head
strokeWeight(10);
if (mouseX < 320) {
stroke(0);
}
}