//Anna Anderson
//Section D
//aranders@andrew.cmu.edu
//project-03
var pbsize = 30
var pbcolor = 0
var pbposition = 275
var jellysize = 30
var jellycolor = 0
var jellyposition = 25
function setup() {
createCanvas(600, 400);
}
function draw() {
background(218, 145, 223)
noStroke();
//left bread
fill(255);
rect(50, 100, 200, 200);
ellipse(50, 125, 50, 50);
ellipse(250, 125, 50, 50);
//right bread
fill(255);
rect(350, 100, 200, 200);
ellipse(350, 125, 50, 50);
ellipse(550, 125, 50, 50);
//peanut butter color
pbcolor = min(max(0, mouseX), 100);
fill(216, 152, pbcolor);
//peanut butter position and size
pbsize = max(min(mouseX, 150));
pbposition = max(min(mouseY, 375));
rect(pbposition, 125, pbsize, pbsize);
//jelly color
jellycolor = min(max(0, mouseX), 100);
fill(225, jellycolor, 225);
//peanut butter position and size
jellysize = max(min(mouseX, 150));
jellyposition = max(min(mouseY, 75));
rect(jellyposition, 125, jellysize, jellysize);
}
I really like peanut butter and jelly and thought this was a good opportunity to digitally spread the goodness. This project went relatively smoothly and was fun to create!