project 5: wallpaper

floral wallpaperDownload
// isis berymon section D

function setup() {
    createCanvas(600, 600);
    background(206, 214, 204); //light green
}

function draw() {
    var x = -20; //negative so pattern doesnt stop at edge
    var y = -20;
    for(var i = 0; i < 6; i++){
        for(var j = 0; j < 6; j++){
            tile(x, y);
            x+=120;
        }
        y+=120;
        x = -20;
    }
}

function tile(x, y) {
    push();
    translate(x, y);
    //branches
    stroke(120, 105, 80); //brown
    line(26, 0, 38, 12); //touches top
    line(40, 19, 20, 39);
    line(0, 27,14, 14); //touches left 1
    line(4, 24, 54, 73);
    line(54, 73, 70, 56);
    line(47, 66, 33, 80);
    line(24, 74, 13, 63);
    line(13, 63, 0, 75); //touches left 2
    line(27, 120, 15, 108); //touches bottom
    line(15, 108, 29, 94);
    line(29, 94, 41, 106);
    line(41, 106, 64, 83);
    line(64, 83, 84, 102);
    line(84, 102, 93, 93);
    line(92, 120, 115, 97);
    line(115, 97, 91, 73);
    line(91, 73, 104, 59);
    line(104, 59, 120, 75); //touches right 2
    line(97, 66, 88, 57);
    line(88, 57, 98, 46);
    line(120, 27, 108, 37); //touches right 1
    line(108, 37, 88, 17);
    line(88, 17, 91, 13);
    //flowers
    flower(41, 20);
    flower(102, 42);
    flower(18, 46);
    flower(73, 53);
    flower(28, 79);
    flower(63, 88);
    flower(12, 110);
    flower(93, 124);
    pop();
}

function flower(x, y) {
    noStroke();
    fill(187, 166, 212); //purple petals
    circle(x, y-6, 10);
    circle(x+6, y, 10);
    circle(x, y+6, 10);
    circle(x-6, y, 10);
    circle()
    fill(240, 228, 188); //yellow center
    circle(x, y, 6);
}

Leave a Reply