Xiaoying Meng- Project 05 Wallpaper

sketch

var tw=17;
var th=25;
function setup() {
    createCanvas(600, 300);
    background(218,235,209);
}

function draw() {
    //background
    for (var z=5; z<600; z=z+25){
        for(var b=2; b< 300; b= b+20){
                    ellipse(z,b,0.1,0.1);
        }
    }

    for (var x=1; x<7; x++){
        for (var y=1; y<5; y++){

            //pot
            if (x%2===1){
                fill(234,186,195);
            }
            else {
                fill(166,203,221);
            }

            stroke(0);
            strokeWeight(0.5);
            rect(x*tw*5,y*th*2.5,20,23);
            line(x*tw*5,y*th*2.5+5,x*tw*5+20,y*th*2.5+5);

            //plant
            
            fill(61,133,50);
            //middle part
            beginShape();
            curveVertex(x*tw*5+5,y*th*2.5);
            curveVertex(x*tw*5+5,y*th*2.5);
            curveVertex(x*tw*5+5,y*th*2.5-9);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+15,y*th*2.5-9);
            curveVertex(x*tw*5+15,y*th*2.5);
            curveVertex(x*tw*5+15,y*th*2.5);
            endShape();

            //left part

            beginShape();
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-20);
            curveVertex(x*tw*5+7,y*th*2.5-25);
            curveVertex(x*tw*5,y*th*2.5-27);
            curveVertex(x*tw*5-5,y*th*2.5-20);
            curveVertex(x*tw*5,y*th*2.5-15);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            endShape();

            //right part
            beginShape();
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-20);
            curveVertex(x*tw*5+7,y*th*2.5-25);
            curveVertex(x*tw*5,y*th*2.5-27);
            curveVertex(x*tw*5-7,y*th*2.5-25);
            curveVertex(x*tw*5-5,y*th*2.5-20);
            curveVertex(x*tw*5,y*th*2.5-15);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            endShape();

            beginShape();
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+15,y*th*2.5-15);
            curveVertex(x*tw*5+20,y*th*2.5-25);
            curveVertex(x*tw*5+22,y*th*2.5-30);
            curveVertex(x*tw*5+13,y*th*2.5-28);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            curveVertex(x*tw*5+10,y*th*2.5-13);
            endShape();
            // dots

            noFill();
            strokeWeight(1);
            ellipse(x*tw*5,y*th*2.5-25,1,1);
            ellipse(x*tw*5-2,y*th*2.5-20,1,1);
            ellipse(x*tw*5+5,y*th*2.5-17,1,1);
            ellipse(x*tw*5+10,y*th*2.5-9,1,1);
            ellipse(x*tw*5+7,y*th*2.5-3,1,1);
            ellipse(x*tw*5+15,y*th*2.5-7,1,1);
            ellipse(x*tw*5+15,y*th*2.5-20,1,1);
            ellipse(x*tw*5+20,y*th*2.5-27,1,1);



        }
    }

noLoop();
}

I created this wallpaper choosing my favorite plant cactus. I first sketched out the cactus I want to draw. After I finished the code for the plants, I decided to add dots to the background and switching the color for the pots to make it a little more interesting.

Leave a Reply