sketch//Jessie Chen
//D
//Project 05
//Floral Wallpaper
function setup() {
createCanvas(600, 600);
background(255, 247, 224);
noLoop();
}
function draw() {
//background white dots
for (var x = 0; x <= width; x += 10) {
for (var y = 0; y<= height; y += 10) {
dots(x,y);
print(dots);
}
}
push();
//rows of red flowers
translate(-200, -85);
for (x = 0; x <= width * 2; x += 200) {
for (y = 0; y < height * 2; y += 400) {
push();
translate(x, y);
rotate(radians(25));
flower(0, 0, 220, 50, 20);
pop();
}
}
//rows of brown flowers
translate(100, 100);
for (x = 0; x <= width * 2; x += 200) {
for (y = 0; y < height* 2; y += 400) {
push();
translate(x, y);
rotate(radians(55));
flower(0, 0, 112, 66, 36);
pop();
}
}
//rows of green flowers
translate(-100, 100);
for (x = 0; x < width * 2; x += 200) {
for (y = 0; y < height* 2; y += 400) {
push();
translate(x, y);
rotate(radians(25));
flower(0, 0, 130, 186, 114);
pop();
}
}
//rows of orange flowers
translate(100, 100);
for (x = 0; x < width * 2; x += 200) {
for (y = 0; y < height * 2; y += 400) {
push();
translate(x, y);
rotate(radians(55));
flower(0, 0, 255, 133, 2);
pop();
}
}
pop();
//rows of small pink flowers
translate(-95, -45);
for (x = 0; x < width * 2; x += 200) {
for (y = 0; y < height * 2; y += 400) {
push();
translate(x, y);
smallflower(0, 0, 255, 163, 163);
pop();
}
}
//rows of small brown flowers
translate(50, 95);
for (x = 0; x < width * 2; x += 200) {
for (y = 0; y < height * 2; y += 400) {
push();
translate(x, y);
smallflower(0, 0, 156, 116, 65);
pop();
}
}
//row of small green flowers
translate(145, 100);
for (x = 0; x < width * 2; x += 200) {
for (y = 0; y < height * 2; y += 400) {
push();
translate(x, y);
smallflower(0, 0, 161, 214, 157);
pop();
}
}
//rows of small orange flowers
translate(55, 100);
for (x = 0; x < width * 2; x += 200) {
for (y = 0; y < height * 2; y += 400) {
push();
translate(x, y);
smallflower(0, 0, 255, 167, 89);
pop();
}
}
}
//background dot
function dots(x,y) {
noStroke();
fill(255);
ellipse(x, y, 5, 5);
}
//one regular flower
function flower(x, y, r, b, g) {
noStroke();
fill(r, b, g);
push();
rect(30, 20, 30, 40, 15, 15, 10, 10);
translate(95, 5);
rotate(radians(72));
rect(30, 20, 30, 40, 15, 15, 10, 10);
translate(95, 5);
rotate(radians(72));
rect(30, 20, 30, 40, 15, 15, 10, 10);
translate(95, 5);
rotate(radians(72));
rect(30, 20, 30, 40, 15, 15, 10, 10);
translate(95, 5);
rotate(radians(72));
rect(30, 20, 30, 40, 15, 15, 10, 10);
pop();
//yellow center
fill(255, 215, 135);
ellipse(43, 68, 30, 30);
}
//small flowers
function smallflower(x, y, r, b, g) {
noStroke();
fill(r, b, g);
push();
rect(3, 20, 15, 20, 15, 15, 10, 10);
translate(40, -5);
rotate(radians(72));
rect(30, 20, 15, 20, 15, 15, 10, 10);
translate(65, -5);
rotate(radians(72));
rect(30, 20, 15, 20, 15, 15, 10, 10);
translate(65, -5);
rotate(radians(72));
rect(30, 20, 15, 20, 15, 15, 10, 10);
translate(65, -5);
rotate(radians(72));
rect(30, 20, 15, 20, 15, 15, 10, 10);
pop();
//yellow center
fill(255, 215, 135);
ellipse(10, 42, 13, 13);
}