Curran Zhang- Project 05- Wallpaper

sketch

/*Curran Zhang 
curranz
Project 5
Section A
*/

function setup() {
    createCanvas(600, 600);   
}

function draw() {
    background(128);
    var rectl = 100;
    var rectw = 100;
    var oy = rectw/2;
    var ox = rectl/2;
    var ml = 50;
    var mw = 5;

//Applying the gradient on shapes that are fixed
    for (var x = 0; x < width; x+=rectl) {
        for (var y  = 0; y <height; y+= rectw){
            var R = map(x,0,width,100,300);
            var B = map(y,0,height,100,200);
            var R1 = map(x,0,width,300,100);
            var B1 = map(y,0,height,200,100);

            fill(R,200,B);
            stroke(275);
            strokeWeight(.4);
            rect(x,y,rectl,rectw);

            fill(R1,200,B1);
            noStroke();
            ellipse(x+rectl/2+6,y+rectw/2+4,50,50);  
        }
    }
//Creating variations in color based using the grid
    for (var x = 0; x < 6; x++) {
        for (var y = 0; y < 6; y++) {
            var py = oy + y * rectl;
            var px = ox + x * rectw;
        
            fill('red');
            if (y % 2 == 0) 
                {if (x % 2 == 0){fill('green')}
                };
            if (y % 2 != 0) 
                {if (x % 2 != 0){fill('purple')}
                };
            noStroke();
            ellipse(px,py-1.5,50,50);

            fill(220);
            noStroke();
            arc(px,py,50.8,50.8,0,PI);

            fill(0);
            ellipse(px,py+.5,17,17);
            rect(px-ml/2, py-mw/2+1,ml,mw);

            fill(275)
            stroke(0);
            strokeWeight(1);
            ellipse(px,py,12,12);
            ellipse(px,py,7,7);
        }
    }
}

With the topic of wallpaper, my childhood self use to want my room to be filled with things from the Pokemon games. Thus for the project I decided to create a wallpaper that related to Pokemon. With the usage of PokeBalls, they vary in colors and design. Through for loops and if statements, i was able to vary the different colors within the array.

Leave a Reply