/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://bard117s14.sketchpad.cc/sp/pad/view/ro.cGvMIdepQcG/rev.6
*
* authors:
* Lauren Harris
* 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
/* Lauren Harris
02/18/14
[email protected]
Self-Portrait II
In this sketch I built upon my previous sketch, Self-Portrait I.
While Self-Portrait I was a static drawing, Self-Portrait II is
a dynamic and interactive animation. What makes this sketch dynamic
and interactive is the use of terms like "random()" and "frameCount()",
as well as keyboard and mouse commands, and conditionals.
I used "frameCount()" to change the colors of the whites of the eyes--
when the sketch is run they start black and fade in correlation with the
sketch's frame count.
I used "random()" to change the color of the irises randomly.
When a key is pressed and held the background changes to black
and white rectangles appear. The location of the retangles is
somewhat random, with one having its x coordinate fixed, and the
other its y coordinate fixed. The size of the rectangles is based
on mouse placement.
When the mouse is clicked the background resets itself back to blue.
Drawing a dynamic and interactice program is much more complicated
than drawing a static image. Because of this good organization
becomes extremely important. However, despite being more difficult
it is more fun because you can express ideas that go beyond a
stationary image. With dynamic and interactive images you can engadge
whoever is using the program in formats such as games, stories, etc.
*/
void setup() {
background(8, 255, 236);
size(400, 600);
}
void draw() {
frameRate(20);
if (keyPressed) {
background(0);
fill(255);
rect(random(50, 255), 1, random(mouseX), random(mouseY));
rect(1, random(50, 255), random(mouseX), random(mouseY));
}
//face
fill(255, 233, 173);
ellipse(200, 300, 300, 400);
//eyes
fill(frameCount);
ellipse(150, 300, 75, 50);
ellipse(250, 300, 75, 50);
//iris
fill(random(1, 255), 100, 100);
ellipse(150, 300, 20, 20);
ellipse(250, 300, 20, 20);
//mouth
fill(#E339CF);
ellipse(200, 400, 100, 50);
//hair
fill(#503504);
rect(20, 175, 75, 375);
rect(300, 175, 75, 375);
rect(20, 100, 355, 95);
//brows
rect(110, 250, 75, 10);
rect(215, 250, 75, 10);
//nose
fill(0);
ellipse(188, 350, 10, 10);
ellipse(212, 350, 10, 10);
if (mousePressed) {
background(8, 255, 236);
}
}