/* Miranda Luong
mluong@andrew.cmu.edu
Section E
Project-05
*/
function setup() {
createCanvas(600, 400);
background(80,100,200);
var tw = width/10;
var th = 60;
var oy = 50;
var ox = 33;
//create 6 rows
for (var y = 0; y < 6; y++) {
//for every even row
if (y % 2 == 0){
stroke(40,180,40);
strokeWeight(2);
//creates 5 sets of twin cherries
for (var x = 0; x < 5; x++) {
var py = oy + y * th;
var px = ox + x * (tw*2);
//back cherry
fill(165,40,40)
ellipse(px-8, py, 25);
//front cherry
fill(180,40,40);
ellipse(px+5, py,30)
//connecting stem
noFill();
arc(px+15, py-10, 50, 50, PI, PI+QUARTER_PI);
arc(px+22, py-30, 50, 60, 2.25, 3);
triangle(px-5,py-29,px-1,py-29,px-3,py-27)
}
//for every odd row
} else {
//creates oranges
for (var x = 0; x < 5; x++) {
var py = oy + y * th;
var px = (ox*2.5) + x * tw*2;
stroke(40,170,40);
fill(180,100,40);
ellipse(px, py, 40);
//inside orange pattern
ellipse(px,py,2)
ellipse(px,py-10,1,12);
ellipse(px,py+10,1,12);
ellipse(px-10,py,12,1);
ellipse(px+10,py,12,1);
}
}
}
noLoop();
}
function draw() {
// draw is not called due to noLoop() in setup()
}
I referenced Assignment 2 to create the grid for my wallpaper. I think that assignment was a great exercise for understanding spacing. This was the first time I used the arc module. I never usually create shapes in my projects, but I had a lot of fun making this wallpaper. I decided to draw cherries and oranges because they are my favorite fruit. I tried to play around with colors, which is why I utilized such a bright green to contrast the red and orange.