////Yoonseo(Dave) Choi
//Section B
//yoonseo1@andrew.cmu.edu
//Project 05 - Wall Paper
function setup() {
createCanvas(480, 480);
background(0); //set back ground to black
}
function draw() {
noStroke(); // removing Stroke from the petals
for (var p = 0;p < 12; p ++){ // setting for loop for patter
for (var j = 0; j <12; j ++){
var red = map(p*200,0,height,0,255); //color set for red
var green = map(j*200,0,width,0,255); //color set for green
petal(p*200+90,j*200+90,red,green,random(0,255)); //execute petal
stroke(255,4); //set stroke color
line(p*40,0,p*40,height); //vertical stroke
line(0,p*40,p*40,0); // diagonal stroke
line(width,p*40,p*40,height); // diagonal stroke
noStroke(); // no stroke for the petal
}
}
noLoop(); //only run once
}
function petal(x,y,r,g,b){ //petal function
push(); // setting geomety
scale(0.45); //scale down whole thign by 0.45 too big initially
fill(r,0,b); // set color of petals
rectMode(CENTER); // settting center to middle
translate(x,y); //translate to x, y coordinate given at execution
for (var i = 0; i < 6; i ++){ //for loop for petal rotation
push();
scale(1.1) //scale petals up by 1.1
rotate(TWO_PI*i/6); //make them rotate around the center
translate(50,0); //translate them 50 from the cente
rotate(180); //rotate the single petals by 180 to create form intended
beginShape(); //half of petal
vertex(40,20);
bezierVertex(70,30,40,50,40,60);
endShape();
beginShape(); //another half of petal
vertex(40,20);
bezierVertex(-10,35,40,50,40,0);
endShape();
pop();// pop the form
}
pop(); //pop the whole
}
For this project I started with a flower initially to create a wall paper pattern. I started to modify the form from there and transformed the petals into irregular petal shapes. I have populated them by giving 6 petals a center. I had to scale the petal sizes down because they were too big initially. I have used the color to give random variation through out the wall paper. I have used for loop and random variable for the color lies inside of the loop. After the placement of the petals, it needed extra color of form to contrast with. I decided to put white transparent thin lines to give emphasis on the petals and contrast through out whole wall paper pattern.