Project 05

I made 2 repeating patterns using squares, flower, and arcs 🙂

sketch
// Sowang Kundeling Section C Project 05

var size = 40;

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

function draw() {
    background(82, 30, 49)

    for (var x = 20; x <= 400; x += 50) {
        for (var y = 20; y <= 600; y += 100) {
            push();
            tealsquare(x, y);
            pop();
            
        }    
    }

    for (var x = 20; x <= 400; x += 50) {
        for (var y = 70; y <= 600; y += 100) {
            push();
            bluesquare(x, y);
            pop();           
        }    
    }

    noLoop();
}
function tealsquare(x, y) {
    // square
    noStroke();
    fill('teal');
    rect(x, y, size/2, size/2);
    
    // flower
    stroke('black');
    fill('lightblue');
    ellipse(x, y + size/6, size/3);
    ellipse(x, y - size/6, size/3);
    ellipse(x + size/6, y, size/3);
    ellipse(x - size/6, y, size/3);
    fill(84, 58, 68);
    ellipse(x, y, size/3);

    // arc
    noFill();
    stroke('lightblue');
    arc(x, y, 50, 50, 0, HALF_PI);
}

function bluesquare(x, y) {
    // circle
    noStroke();
    fill('lightblue');
    rect(x, y, size/2, size/2);
    
    //flower
    stroke('white');
    fill('teal');
    ellipse(x, y + size/6, size/3);
    ellipse(x, y - size/6, size/3);
    ellipse(x + size/6, y, size/3);
    ellipse(x - size/6, y, size/3);
    fill(84, 58, 68);
    ellipse(x, y, size/3);

    // arc
    noFill();
    stroke('teal');
    arc(x, y, 50, 50, 0, HALF_PI);
}

Leave a Reply