P-05 Wallpaper

Took inspiration from a tile pattern for this project.

sketch
// Bridget Doherty, bpdohert, 104 Section C


// global color variables
var greyValue = 150;
var bckg = 240;
var lineCol = 0;

function setup() {
    createCanvas(550, 380);
    background(bckg);
}

function draw() {
    for (var i=50; i<=height; i+=93) {
        for (var j=50; j<=width; j+=93){
            clover(j, i);
        }
    }
    for (var i=3; i<=width+50; i+=93){
        for (var j=3; j<=height+50; j+=93){
            innerCircle(i, j);
        } 
    }
    noLoop();
}

function clover(x, y){
    var diam1 = 40;
    var diam2 = 31;
    var spacer = 26;

    // clover outer grey section
    strokeWeight(1);
    stroke(lineCol);
    fill(greyValue);
    circle(x, y-spacer, diam1);
    circle(x, y+spacer, diam1);
    circle(x-spacer, y, diam1);
    circle(x+spacer, y, diam1);

    // clover inner white section
    fill(bckg);
    circle(x, y-spacer, diam2);
    circle(x, y+spacer, diam2);
    circle(x-spacer, y, diam2);
    circle(x+spacer, y, diam2);
    noStroke();
    circle(x, y, 41);

    // petals outline
    stroke(lineCol);
    strokeWeight(7);
    line(x-15, y-7, x-7, y-15);
    line(x+15, y-7, x+7, y-15);
    line(x-15, y+7, x-7, y+15);
    line(x+7, y+15, x+15, y+7);

    // lines to complete the clover inner points
    stroke(greyValue);
    strokeWeight(8);
    line(x-12, y-12, x-15, y-15);
    line(x+12, y-12, x+15, y-15);
    line(x-12, y+12, x-15, y+15);
    line(x+12, y+12, x+15, y+15);

    // circles outline
    noStroke();
    fill(lineCol);
    circle(x-7, y-7, 12);
    circle(x+7, y-7, 12);
    circle(x-7, y+7, 12);
    circle(x+7, y+7, 12);

    // grey petals inside clover
    stroke(greyValue);
    strokeWeight(4);
    line(x-15, y-7, x-7, y-15);
    line(x+15, y-7, x+7, y-15);
    line(x-15, y+7, x-7, y+15);
    line(x+7, y+15, x+15, y+7);

    strokeWeight(1);
    fill(greyValue);
    circle(x-7, y-7, 8);
    circle(x+7, y-7, 8);
    circle(x-7, y+7, 8);
    circle(x+7, y+7, 8);
    
}

function innerCircle(x,y){
    var cross = 6;

    // circles in between the clovers
    strokeWeight(1);
    stroke(lineCol);
    fill(greyValue);
    circle(x, y, 61);
    fill(bckg);
    circle(x, y, 50);

    // plus sign in the middle of the circles
    strokeWeight(7);
    stroke(lineCol);
    line(x+cross, y, x-cross, y);
    line(x, y-cross, x, y+cross);
    strokeWeight(4);
    stroke(greyValue);
    line(x+cross, y, x-cross, y);
    line(x, y-cross, x, y+cross);
}

Leave a Reply