Skip to content

Instantly share code, notes, and snippets.

@rlieberman
Created September 17, 2014 15:24
Show Gist options
  • Save rlieberman/6f75865be36971ff88f5 to your computer and use it in GitHub Desktop.
Save rlieberman/6f75865be36971ff88f5 to your computer and use it in GitHub Desktop.
Psychedelic Pizza
//variables for moving olives
float olive1X;
float olive1Y;
float olive2X;
float olive2Y;
float olive3X;
float olive3Y;
float olive4X;
float olive4Y;
float olive5X;
float olive5Y;
//variables for resizing pepperoni
float peppWidth;
float peppHeight;
void setup() {
size(1000, 790);
background(18, 255, 204);
//pizza shadow
noStroke();
fill(54, 158, 136);
triangle(300, 150, 900, 150, 600, 750);
ellipse(600, 150, 598, 100);
//pizza crust
noStroke();
fill(194, 151, 52);
triangle(200, 100, 800, 100, 500, 700);
ellipseMode(CENTER);
ellipse(500, 100, 598, 100);
//pizza background
noStroke();
fill(247, 204, 106);
triangle(225, 150, 775, 150, 500, 700);
ellipseMode(CENTER);
ellipse(500, 155, 545, 75);
}
void draw () {
// ellipseMode(CENTER);
// ellipse(600, 150, 598, 100);
// //pizza crust
// noStroke();
// fill(194, 151, 52);
// triangle(200, 100, 800, 100, 500, 700);
// ellipseMode(CENTER);
// ellipse(500, 100, 598, 100);
// //pizza background
// noStroke();
// fill(247, 204, 106);
// triangle(225, 150, 775, 150, 500, 700);
// ellipseMode(CENTER);
// ellipse(500, 155, 545, 75);
//spacing help
println(mouseX, mouseY);
//add your own cheese!!!
stroke(255, 247, 8);
strokeWeight(15);
strokeCap(ROUND);
line(pmouseX, pmouseY, mouseX, mouseY);
//QUESTION 1: is there a way to set where the mouse starts
//QUESTION 2: how do i restrict the area in which i can draw the lines? let’s say i just want to draw cheese on the surface of the pizza but not anywhere else
// //add your own tomato sauce!!!
// stroke(232, 90, 46);
// strokeWeight(50);
// line(pmouseX, pmouseY, mouseX, mouseY);
// //QUESTION: is there a way to draw both the tomato sauce and cheese but have them map to different places? couldn’t figure this one out
//green peppers
stroke(random(0), random(50, 255), random(0));
strokeWeight(25);
strokeCap(SQUARE);
line(395, 450, 420, 460);
line(450, 210, 475, 200);
line(500, 410, 525, 400);
line(660, 170, 685, 180);
//rainbow peppers
stroke(random(0,255), random(0,255), random(0,255));
strokeWeight(25);
strokeCap(SQUARE);
line(285,176, 310, 185);
line(475, 300, 450, 290);
line(575, 510, 550, 500);
line(630, 300, 655, 310);
//black olives — drawing
stroke(0);
strokeWeight(12);
fill(153, 135, 106);
//black olives — moving
ellipse(olive1X, olive1Y, 30, 30);
ellipse(olive2X, olive2Y, 30, 30);
ellipse(olive3X, olive3Y, 30, 30);
ellipse(olive4X, olive4Y, 30, 30);
ellipse(olive5X, olive5Y, 30, 30);
olive1X = random(370, 375);
olive1Y = random(200, 202);
olive2X = random(445, 450);
olive2Y = random (400, 402);
olive3X = random(500, 505);
olive3Y = random(628, 630);
olive4X = random (550, 555);
olive4Y = random (315, 318);
olive5X = random (635, 640);
olive5Y = random (225, 227);
//drawing the pepperoni
noStroke();
fill(219, 86, 55);
ellipse(370, 300, 100, 100);
ellipse(480, 515, 100, 100);
ellipse(550, 220, 100, 100);
ellipse(590, 400, 100, 100);
}
void mousePressed() {
//reset background
background(18, 255, 204);
//reset pizza shadow
noStroke();
fill(54, 158, 136);
// fill(random(0,255), random(0,255), random(0,255));
triangle(300, 150, 900, 150, 600, 750);
ellipse(600, 150, 598, 100);
//reset pizza crust
noStroke();
fill(194, 151, 52);
triangle(200, 100, 800, 100, 500, 700);
ellipseMode(CENTER);
ellipse(500, 100, 598, 100);
//reset pizza background
noStroke();
fill(247, 204, 106);
triangle(225, 150, 775, 150, 500, 700);
ellipseMode(CENTER);
ellipse(500, 155, 545, 75);
//reseting the size of the pepperoni
noStroke();
fill(219, 86, 55);
ellipse(370, 300, peppWidth, peppHeight);
ellipse(480, 515, peppWidth, peppHeight);
ellipse(550, 220, peppWidth, peppHeight);
ellipse(590, 400, peppWidth, peppHeight);
peppWidth = random (50, 150);
peppHeight = random (50, 150);
peppWidth = peppHeight;
//QUESTION: I’m running into some wacky layering stuff in this part. I know it’s because of something to do with the setup vs draw and where the background is, but I can’t figure it out exactly. how do I get the new pepperoni to overwrite the old ones altogether so that the cheese is always being drawn underneath?
// //make a circle appear where the cheese stops
// noStroke();
// fill(random(255), random(255), random(255));
// ellipseMode(CENTER);
// ellipse(mouseX, mouseY, 100, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment