Liu Xiangqi-Project-05

sketch

// Liu Xiangqi xiangqil@andrew.cmu.edu Section A Project-05

function setup() {
    createCanvas(600, 600);
    background(0);
    noLoop();
    
}


function draw() {
    var y = 0;
    var x = 0;
    for (y = 0; y + 50 < height - 50; y += 100){
        for (x = 0; x + 50 < width - 50; x += 100){
            //draw the roses
            fill(255);
            ellipse(50+x, 50+y, 10, 10);
            stroke(255, 77, 77);
            strokeWeight(6);
            noFill();
            for(var i = 1; i < 11; i ++){
                if (i%4 == 1) {
                    arc(50+x, 50+y, 4*i + 12.5, 4*i + 12.5, 0, HALF_PI);
                }else if (i%4 == 2) {
                    arc(50+x, 50+y, 4*i + 20, 4*i + 20, HALF_PI, PI);
                }else if (i%4 == 3) {
                    arc(50+x, 50+y, 4*i + 27.5, 4*i + 27.5, PI, PI+HALF_PI);
                }else{
                    noFill();
                    arc(57+x, 45+y, 4*i + 5, 4*i + 5, PI+HALF_PI, TWO_PI+QUARTER_PI);
                }
            }
            //draw the leaves
            fill(204, 255, 153);
            noStroke();
            beginShape();
            vertex(50+x, 80+y);
            curveVertex(50+x, 80+y);
            curveVertex(80+x, 100+y);
            curveVertex(90+x, 120+y);
            curveVertex(80+x, 110+y);
            curveVertex(50+x, 80+y);
            vertex(50+x, 80+y);
            endShape();
        }
    }
    
}

Leave a Reply