Made in honor of the moldy tomato I found at the back of my fridge. Rest in peace.
tomatoes
//Iris Yip
//15104 Section D
var bgColorR=0;
var bgColorG=0;
var bgColorB=0;
var faceWidth=200;
var faceHeight=300;
var eyeShape=0;
var eyeColor=0;
var smileYN=1;
var leafColor=1;
var leafLength=1;
var leafHeight=1;
//I need better names for my variables
function setup() {
createCanvas(600, 600);
}
function draw() {
//background
background(bgColorR, bgColorG, bgColorB)
//faceshape
noStroke();
fill(225, bgColorB, 110)
ellipse(300, 300, faceWidth, faceHeight);
//nose
fill(225, bgColorB-20, 120)
ellipse(300, 316, faceWidth/30, faceHeight-250)
//eyes
fill(255,255.255)
ellipse(205, 290, (faceWidth/4), (faceHeight/4));
ellipse(390, 290, (faceWidth/4), (faceHeight/4));
fill(bgColorR,bgColorG,bgColorB)
ellipse(390, 290, 50, 50);
ellipse(205, 290, 50, 50);
//mouth
noFill()
strokeWeight(10)
stroke(225, bgColorB+50, 110)
arc(270, 380, 120, (smileYN), PI + QUARTER_PI, TWO_PI)
//leaf things
noStroke();
fill(bgColorR, 255-(bgColorG/3), (bgColorB-100))
triangle(leafLength, 150, 300, 130, 240, leafHeight);
triangle(leafLength, 200, 300, 130, 220, leafHeight);
triangle(leafLength+20, 150, 300, 130, 200, leafHeight+60);
//label
fill(255);
textSize(20);
textAlign(CENTER);
text("So Many Tomatoes",width/2,560);
}
function mousePressed() {
//background color
bgColorR = random(120, 130);
bgColorG = random(80, 90);
bgColorB = random (110, 120);
//faceshape change
faceWidth= random(250,450);
faceHeight= random (300,300);
//nose
//smile, yes/no
smileYN= random(2,100);
//leaf things
leafHeight=random (120,150);
leafLength=random (300,340);
}
The code for this project was relatively simple in terms of creating and using the different shapes, but I did initially have a lot of trouble coming up with colors that still looked different but didn’t clash. I do regret not going in with a plan or initial sketch because I think it inhibited me from trying out more ambitious commands and shapes.