With this project, I wanted to create a pattern that had a cooking element to it as if the design could be placed on an apron. I choose to use a sunflower yellow color pallette for a pleasant tone. A coffee bean, straw, and cup are present.
//Yoshi Torralva
//yrt@andrew.cmu.edu
//Section E
//Project-05-Wallpaper
function setup() {
createCanvas(600, 600);
}
function draw() {
background(0);
// nested loop for x + y rows
for (var x = 0; x < width / 3; x+=1) {
for (var y = 0; y < height / 8; y+=1) {
// var bay and bax made to adjust function b coordinates
var bay = y * 100; // adjustment to space squares evenly
var bax = x * 200; // adjustment to space squares evenly
ba(bax, bay);
// subtracting 50px to create alternating design
b(bax, bay - 50);
}
}
}
// dark yellow background
function ba(x, y) {
push();
translate(x, y);
fill(221, 178, 16);
noStroke();
rect(0, 0, 100, 100);
fill(253, 215, 70);
ellipse(50, 50, 80, 80);
fill(221, 178, 16);
ellipse(50, 50, 70, 70);
//coffee
fill(136, 97, 13);
ellipse(50, 50, 70, 70);
//straw above mouseIsPressed to appear
stroke(253, 215, 70);
strokeWeight(5);
line(50, 50, 10, 10);
pop();
}
// coffee bean tile
function b(x,y) {
push();
translate(x, y);
fill(0);
textSize(32);
noStroke();
fill(253, 215, 70);
rect(100, 0, 100, 100);
fill(221, 178, 16);
ellipse(150, 50, 80, 90);
fill(253, 215, 70);
rect(140, 0, 20, 100);
pop();
}