/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://bard117s14.sketchpad.cc/sp/pad/view/ro.edfyYZOsenD/rev.4
*
* authors:
* Laura Salgarolo
* 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
/* Laura Salgarolo
February 18, 2014
[email protected]
Self-Portrait II
It was interesting trying to balance creating some layers of the image
on setup and some on draw and it took a bit of getting used to trying
figure out what goes before what. Still having some trouble with the
limited shapes I can use because learning them from the Processing
references isn't always quite clear so I have to improvise or make do
with other shapes.My body is the static part of the image and the
grass that grows does so by itself without command. If you hold and
press the mouse the flower grows and I change a bit, but the flower's
color is determined randomnly (as long as you keep the mouse
pressed). */
float grass= 500; //y component of growing grass
float weight= 20; //for grass to thin out
float weight2= 30;//for grass2
float stem = 500; //y for flower stem
void setup () {
size (500, 500);
smooth ();
background (189, 217, 234); //sky blue
ellipseMode (CENTER);
rectMode (CENTER);
noStroke();
//body
fill (197, 229, 197);
ellipse(260, 475, 200, 400);
//hair
strokeWeight (15);
stroke (131, 89, 57);
line (200, 290, 200, 400);//braid
strokeWeight (1);
stroke (80, 50, 40);
line (193, 300, 207, 325);
line (207, 320, 193, 350);
line (193, 350, 207, 370);
//book
strokeWeight (1);
stroke(0);
//pages
fill (237, 236, 213);
quad (170, 360, 170, 480, 260, 520, 260, 400);//left
quad (350, 360, 350, 480, 260, 520, 260, 400);//right
//binding
fill (116, 42, 5);
rect (260, 460, 20, 115);//spine
quad (160, 364, 160, 484, 250, 524, 250, 404);//left
quad (360, 364, 360, 484, 270, 524, 270, 404);
//hands
noStroke();
fill (240, 209, 186);//skin tone
ellipse (225, 497, 40, 40);//left
ellipse (295, 497, 40, 40);//right
//head
noStroke();
ellipse (185, 260, 20, 40);//left ear
ellipse (335, 260, 20, 40);//right ear
ellipse (260, 260, 140, 200);
//hair strands
stroke (131, 89, 57);
strokeWeight (4);
noFill();
arc (180, 250, 30, 100, PI+HALF_PI, TWO_PI+HALF_PI);
arc (315, 250, 30, 100, PI+HALF_PI, TWO_PI+HALF_PI);
//eyes
stroke (0);
strokeWeight (2);
arc (230, 260, 20, 10, 0, PI);
arc (290, 260, 20, 10, 0, PI);
//nose
arc (260, 290, 25, 12, 0, PI);
//eyebrows
stroke (131, 89, 57);//hair brown
arc (230, 250, 24, 8, PI, TWO_PI);
arc (290, 250, 24, 8, PI, TWO_PI);
//hat
noStroke();
fill (232, 202, 136);
ellipse (260, 210, 300, 70);
ellipse (260, 180, 140, 120);
}
void draw () {
//petal colors
float r= random (200, 255);
float b= random (0, 200);
//blades of grass growing set 1
stroke (100, 113, 70);//olive green
strokeWeight(weight);
point(50, grass);
point(80, grass);
point(450, grass);
grass= grass-1;//grass gets taller
weight=weight-.042;//grass gets thinner
if (weight<1) { //stop the thickness from disappearing
weight=1;
}
if (grass<100) { //stop the grass at y=100
grass=100;
}
//grass set 2
stroke(145, 160, 108);
strokeWeight (weight2);
point (150, grass);
point (420, grass);
point (15, grass);
point (380, grass);
point (475, grass);
point (120, grass);
weight2=weight2-.06;
if (weight2<1) {
weight2=1;
}
//grow a flower
if (mousePressed==true) {
strokeWeight (5);
point (260, stem);
stem=stem-1;
if (stem<440) {
stem=440;
noStroke();
fill (r, 150, b);//petals
ellipse (260, 422, 15, 15);
ellipse (250, 430, 15, 15);
ellipse (270, 430, 15, 15);
ellipse (254, 440, 15, 15);
ellipse (266, 440, 15, 15);
fill (247, 226, 150);//flower center
ellipse (260, 433, 15, 15);
//smile to appear
stroke (242, 122, 126);
strokeWeight (3);
noFill();
arc (260, 315, 50, 17, 0, PI);
}
}
}