Project-05-Wallpaper

Wallpaper

sketch
//Brody Ploeger
//jploeger
//Section C

function setup() {
    createCanvas(600, 600);
    background(220);
    //text("p5.js vers 0.9.0 test.", 10, 15);
}
var x=0;
var y=0;


function draw() {
background(200);
//loop 
for(var i = 0; i<=width; i+=100){
    for(var j = 0; j<=height; j+=200){
   Pattern(x+i,y+j,100); 
}
}
//offset loop
for(var i = -50; i<=width; i+=100){
    for(var j = 100; j<=height; j+=200){
   Pattern(x+i,y+j,100); 
}
}


}

function Pattern(x,y,w){

//base square
strokeWeight(2);
fill('tan');
square(x,y,w);

//pruple lines
strokeWeight(3);
stroke('purple');
line(w/8+x,0+y,w/8+x,w+y);

strokeWeight(3);
stroke('purple');
line(w/8+w/2+x,0+y,w/8+w/2+x,w+y);

//black line
stroke(0);
strokeWeight(2);
line(0+x,w/2+w/4+y,w+x,w/2+w/4+y);

noStroke()
//shape 1 
fill(200,10,0);
beginShape();
vertex(w/4+w/2+x,0+y);
vertex(w/4+w/2+x, w/8+y);
vertex(w/8+w/4+x, w/8+y);
vertex(0+x,w/2+y);
vertex(0+x,w/4+w/2+y);
vertex(w/8+w/4+x, w/8+w/4+y);
vertex(w+x,w/4+w/8+y);
vertex(w+x,0+y);
vertex(w/4+w/2+x,0+y);
endShape();


//shape 2 shadow
fill(0,99);
rect(w/4+w/16+x,0+y,w/4,w);

//shape 2
fill(200,10,0);
rect(w/4+x,0+y,w/4,w);



//shape 3 shadow
fill(0,99);
rect(x,w/2+y,w/16,w/2);

//shape 1 shadow
fill(0,99);
rect(x,y,w/16,w/4+w/8);
//shape 3
fill(200,10,0);
rect(w/4+w/2+x,w/2+y,w/4,w/2);
}

Leave a Reply