# Swetha – Generative Wall Paper

For this assignment, I began with generating something that I liked and that looked interesting. This design turned out to me more of an image rather than a wall paper so I took the code and began playing with it in multiple ways, Finally I settled on two other images to include with my piece, both of which are wallpaper/ gift wrap generated from the original.

# So Many Sine Functions

I was watching Lynda.com tutorials of Processing for a good hour or so, and I was interested in the tutorial on how to draw spirals. Drawing any sort of curve is really hard to picture for me, and the tutorial just drew many lines that progress in small increments. Somehow I decided I wanted to do the sine function. I don’t know why I thought that was a good idea, because the computations make this code really slow and inefficient. Or maybe I just wrote the code in a more complex way than necessary… That aside, I learned a lot this week and I’m about to learn more about animation!

```void setup(){
size(500,500);
smooth();
noFill();
background(255);
noLoop();
}

void drawBottom(int n,int t,color fill){
float x;
float dy;
float y=55;
int w=10;
//stroke(complement[int(random(1,5))]);
stroke(fill);
strokeWeight(t);
for(x=0; x<100; x+=0.1){
dy = sin(x*0.65/w)/n;
y+=dy;
line(x, y, x, y);
}
}

void drawMiddle(color fill){
//stroke(complement[int(random(1,5))]);
stroke(fill);
strokeWeight(4);
line(0,50,100,50);
}

void drawTop(int n,int t,color fill){
float x;
float dy;
float y=46;
int w=10;
strokeWeight(t);
//stroke(complement[int(random(1,5))]);
stroke(fill);
for(x=0; x<100; x+=0.1){
dy = -1*(sin(x*0.65/w)/n);
y+=dy;
line(x, y, x, y);
}
}

void drawBlock(color fill){
drawMiddle(fill);
drawTop(12,1,fill);
drawTop(20,2,fill);
drawTop(100,3,fill);
drawBottom(12,1,fill);
drawBottom(20,2,fill);
drawBottom(100,3,fill);
}

void drawLine(color fill){
for(int i=0; i< =width; i+=100) {
pushMatrix();
translate(i,0);
drawBlock(fill);
popMatrix();
}
}

void drawUp(color fill) {
pushMatrix();
translate(-50,-50);
drawLine(fill);
popMatrix();
}

void drawHorizontal(color fill) {
for (int i=0; i<=height; i+=100){
pushMatrix();
translate(0,-6+i);
drawUp(fill);
drawLine(fill);
popMatrix();
}
}

void draw() {
drawHorizontal(150);
pushMatrix();
translate(width-5,0);
rotate(PI/2);
drawHorizontal(120);
popMatrix();
}```