Project 5: Wallpaper

sketch

// John Henley; jhenley; 15-104 section D

function setup() {
    createCanvas(590, 395);
    background(0);
}

function draw() {
    for (var x = 10; x <= 590; x+= 30) { // vertical lines
        linesVertical(x);
    }
    for (var y = 10; y <= 390; y += 30) { // horizontal lines
        linesHorizontal(y);
    }
    for (var y = 10; y <= 390; y += 15) { // circles columns
        for (var x = 10; x <= 590; x+= 15) { // circles rows
            circles(x, y);
        }
    }
noLoop();
}   

function circles(x, y) { //circle function
    stroke(0);
    fill(random(0, 255));
    circle(x,y,random(5, 15));
}

function linesVertical(x) { //vertical lines function (random lengths)
    stroke(255);
    line(x, random(0, 390), x, random(0,390));
}

function linesHorizontal(y) { //horizontal lines function (random lengths)
    line (random(0, 590), y, random(0,590), y)
}

For my wallpaper, I wanted to make a row of lit up circles, almost like an old-fashioned light-up sign. Each of the circles is like a bulb, and despite the pattern with the “for” loops, I made it so the diameter of the circles was chosen randomly to make the image’s picture seemingly change with each refresh. To add visual interest, I added perpendicular lines, chosen with random lengths, cutting through the circles.

Leave a Reply