//Jamie Park (jiminp)
//15-104 Recitation E
//Project 5
var rectSize = 50;
var spacing = 160;
function setup(){
createCanvas(500, 500);
background(212, 230, 135);
//odd row of roses
for (var xWidth = rectSize; xWidth < width + rectSize; xWidth += spacing){
for (var yHeight = rectSize; yHeight < height + rectSize; yHeight += spacing){
rose(xWidth, yHeight);
}
}
//even row of roses
for (var xWidth2 = -rectSize * 0.6; xWidth2 < width + rectSize; xWidth2 += spacing){
for (var yHeight2 = rectSize * 2.6; yHeight2 < height + rectSize; yHeight2 += spacing){
rose(xWidth2, yHeight2);
}
}
noLoop();
}
function draw(){
//nothing in draw because called noLoop
}
function rose(x, y){
noStroke();
//rectangle set to the center to make rotation easy
rectMode(CENTER);
//RED ROSE
//largest square
fill(209, 67, 56);
rect(x, y, rectSize, rectSize);
//second square
push();
translate(x, y)
rotate(radians(45));
fill(217, 95, 87);
rect(0, 0, rectSize * 0.7 , rectSize * 0.7);
pop();
//third square
fill(209, 67, 56);
rect(x, y, rectSize * 0.5, rectSize * 0.5);
//fourth square
push();
translate(x, y)
rotate(radians(45));
fill(217, 95, 87);
rect(0, 0, rectSize * 0.3 , rectSize * 0.3);
pop();
//leaf on the left
push();
translate(x - (rectSize * 0.8), y);
rotate(radians(45));
fill(127, 191, 54);
rect(0, 0, rectSize * 0.4, rectSize * 0.4);
pop();
//leaf on the top
push();
translate(x, y - (rectSize * 0.8));
rotate(radians(45));
fill(66, 171, 31);
rect(0, 0, rectSize * 0.4, rectSize * 0.4);
pop();
//YELLOW ROSE
//largest square
fill(237, 209, 116);
rect(x + rectSize * 1.6, y, rectSize, rectSize);
//second square
push();
translate(x + rectSize * 1.6, y)
rotate(radians(45));
fill(250, 236, 147);
rect(0, 0, rectSize * 0.7 , rectSize * 0.7);
pop();
//third square
fill(237, 209, 116);
rect(x + rectSize * 1.6, y, rectSize * 0.5, rectSize * 0.5);
//fourth square
push();
translate(x + rectSize * 1.6, y)
rotate(radians(45));
fill(250, 236, 147);
rect(0, 0, rectSize * 0.3 , rectSize * 0.3);
pop();
//leaf on the left
push();
translate(x + (rectSize * 0.8), y);
rotate(radians(45));
fill(127, 191, 54);
rect(0, 0, rectSize * 0.4, rectSize * 0.4);
pop();
//leaf on the top
push();
translate(x + rectSize * 1.6, y - (rectSize * 0.8));
rotate(radians(45));
fill(66, 171, 31);
rect(0, 0, rectSize * 0.4, rectSize * 0.4);
pop();
}
I wanted to create alternating rows of “roses” using squares. I am content with the final product, and I wonder what it would look like to have an entire room full of this wallpaper pattern.