function setup() {
createCanvas(410, 380);
background(220);
text("p5.js vers 0.9.0 test.", 10, 15);
}
function draw() {
background(241, 224, 197);
//flowers
for(var column = 1; column <= 7; column += 1) {
//column 1
push();
translate(50, 50 * column);
flowers(1);
pop();
//column 2
push();
translate(150, 50 * column);
flowers(1);
pop();
//column 3
push();
translate(250, 50 * column);
flowers(1);
pop();
//column 4
push();
translate(350, 50 * column);
flowers(1);
pop();
//leaves
for(var row = 1; row <= 7; row += 1) {
//row 1
push();
translate(100, 50 * row);
leaves(1);
pop();
//row 2
push();
translate(200, 50 * row);
leaves(1);
pop();
//row 3
push();
translate(300, 50 * row);
leaves(1);
pop();
}
//dots
for(var shape = 1; shape <= 40; shape += 1) {
fill(41, 39, 76);
//shape 1
push();
translate(10 * shape, 8);
circle(0, 0, 3);
pop();
//shape 1
push();
translate(10 * shape, height - 8);
circle(0, 0, 3);
pop();
}
}
function flowers() {
noStroke();
push();
translate(0, -10);
//pedal color
fill(255, 104, 107);
//pedals
circle(-10, -4, 20);
circle(10, -4, 20);
circle(0, -11, 20);
circle(8, 8, 20);
circle(-8, 8, 20);
//center pedal
fill(247, 230, 48);
circle(0, 0, 10);
pop();
}
function leaves() {
fill(0, 168, 120);
noStroke();
push();
translate(0, -10);
rotate(radians(320));
arc(0, 0, 27, 7, 0, PI, OPEN);
arc(0, 0, 27, 7, PI, 0, OPEN);
pop();
}
}
For this project, I wanted to create a simple, yet visually intriguing wallpaper. I was inspired by Tyler the Creator’s clothing brand, Golf. The simple shapes are repeating patterns are attractive to the eye.
I used for loops to complete the project. I first had to create a function for the different components in the design, such as the flower, the leaves and the dots. Then, using the for loop, I just called the functions and translated it accordingly.