/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://bard117s14.sketchpad.cc/sp/pad/view/ro.QZpVziwGHvH/rev.1
*
* authors:
* Nick Levine
* 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
/*
Nick Levine
[email protected]
February 18, 2014
*/
float x = 250;
float y = 100;
float a = 0;
float b = 0;
float c = 0;
float d = 0;
float e = 0;
float f = 0;
float r = 0;
float g = 0;
float h = 0;
void setup() {
size(500, 200);
smooth();
}
void draw() {
background(200, 10, 40);
//trees
noStroke();
fill(100, 60, 20);
rect(410, 130, 20, 40);
rect(70, 130, 20, 40);
fill(60, 130, 60);
triangle(440, 60, 420, 20, 400, 60);
triangle(460, 100, 420, 40, 380, 100);
triangle(480, 140, 420, 60, 360, 140);
triangle(60, 60, 80, 20, 100, 60);
triangle(40, 100, 80, 40, 120, 100);
triangle(20, 140, 80, 60, 140, 140);
//easing
float vx = .1*(mouseX - x);
float vy = .1*(mouseY - y);
x = x + vx;
y = y + vy;
//head
stroke(1);
fill(250, 230, 190);
ellipse(x, y, 100, 130);
//right ear
ellipse(x+50, y-5, 20, 30);
//left ear
ellipse(x-50, y-5, 20, 30);
//right ear cover
noStroke();
ellipse(x+40, y-5, 20, 30);
//left ear cover
ellipse(x-40, y-5, 20, 30);
//left eyebrow
stroke(0);
strokeWeight(2);
ellipse(x-15, y-15, 40, 40);
//right eyebrow
ellipse(x+15, y-15, 40, 40);
//eyebrow cover
noStroke();
rect(x-40, y-30, 83, 40);
rect(x-7, y-50, 15, 80);
//left eye
fill(255);
stroke(0);
strokeWeight(1);
ellipse(x-17, y-20, 20, 8);
//left pupil
noStroke();
fill(80, 40, 0);
ellipse(x-17, y-20, 8, 8);
fill(255);
ellipse(x-15, y-22, 3, 2);
//right eye
stroke(0);
ellipse(x+17, y-20, 20, 8);
//right pupil
noStroke();
fill(80, 40, 0);
ellipse(x+17, y-20, 8, 8);
fill(255);
ellipse(x+19, y-22, 3, 2);
//mouth
fill(255);
ellipse(x, y+15, 40, 50);
fill(250, 230, 190);
ellipse(x, y+5, 55, 40);
stroke(250, 230, 190);
line(x-15, y+31, x+14, y+31);
line(x-14, y+40, x-14, y+20);
line(x-7, y+40, x-7, y+20);
line(x, y+40, x, y+20);
line(x+7, y+40, x+7, y+20);
line(x+14, y+40, x+14, y+20);
//nose
stroke(100, 85, 65);
line(x+5, y+5, x, y-10);
line(x+5, y+5, x-5, y+3);
if (mousePressed == true) {
background (mouseX, mouseY, mouseY);
//trees
noStroke();
fill(0, 0, mouseY);
rect(410, 130, 20, 40);
rect(70, 130, 20, 40);
fill(mouseY, mouseX, mouseX);
triangle(440, 60, 420, 20, 400, 60);
triangle(460, 100, 420, 40, 380, 100);
triangle(480, 140, 420, 60, 360, 140);
triangle(60, 60, 80, 20, 100, 60);
triangle(40, 100, 80, 40, 120, 100);
triangle(20, 140, 80, 60, 140, 140);
//easing
x = x + vx;
y = y + vy;
//head
stroke(1);
r = random (0, 255);
g = random (0, 255);
h = random (0, 255);
fill(r, g, h);
ellipse(x, y, 100, 130);
//right ear
ellipse(x+50, y-5, 20, 30);
//left ear
ellipse(x-50, y-5, 20, 30);
//right ear cover
noStroke();
ellipse(x+40, y-5, 20, 30);
//left ear cover
ellipse(x-40, y-5, 20, 30);
//left eyebrow
stroke(0);
strokeWeight(2);
ellipse(x-15, y-15, 40, 40);
//right eyebrow
ellipse(x+15, y-15, 40, 40);
//eyebrow cover
noStroke();
rect(x-40, y-30, 83, 40);
rect(x-7, y-50, 15, 80);
//left eye
fill(255);
stroke(0);
strokeWeight(1);
ellipse(x-17, y-20, 20, 8);
//left pupil
noStroke();
fill(80, 40, 0);
ellipse(x-17, y-20, 8, 8);
fill(255);
ellipse(x-15, y-22, 3, 2);
//right eye
stroke(0);
ellipse(x+17, y-20, 20, 8);
//right pupil
noStroke();
fill(80, 40, 0);
ellipse(x+17, y-20, 8, 8);
fill(255);
ellipse(x+19, y-22, 3, 2);
//mouth
fill(255);
ellipse(x, y+15, 40, 50);
fill(r, g, h);
ellipse(x, y+5, 55, 40);
stroke(r, g, h);
line(x-15, y+31, x+14, y+31);
line(x-14, y+40, x-14, y+20);
line(x-7, y+40, x-7, y+20);
line(x, y+40, x, y+20);
line(x+7, y+40, x+7, y+20);
line(x+14, y+40, x+14, y+20);
//nose
stroke(100, 85, 65);
line(x+5, y+5, x, y-10);
line(x+5, y+5, x-5, y+3);
//snow
noStroke();
fill(255, 100);
ellipse(a, b, 10, 10);
ellipse(c, d, 8, 8);
ellipse(e, f, 6, 6);
a=random(0, 500);
b=random(0, 200);
c=random(0, 500);
d=random(0, 200);
e=random(0, 500);
f=random(0, 200);
}
}