Janet Peng Project 05 –Wallpaper

jjpeng project 5

var type;
var color;
var bigness;

function setup() {
    createCanvas(600, 480);
    background('#BFDDDA');
    noStroke();
}

function draw() {
    for (var c = 0; c < 12; c ++) {
        for (var r = 0; r < 8; r ++) {
            type = random([1, 2, 3]);
            color = random(['#92B2C0', '#79A594', '#467E9B'])
            bigness = random(20, 80)
            pattern (c * 60, r * 70, bigness, type, color);
        }
    }
    for (var col = 0; col < 8; col ++) {
        for (var row = 0; row < 6; row ++) {
            // draw grapes
            var wide = random(7, 12);
            var high = random(10, 14);
            if (((col + row) % 2) === 0){
                grapes(col * 85, row * 90, wide, high, '#FF5061');
            } else {
                grapes(col * 85, row * 90, wide, high, '#FF6A4D');
            }
        }
    }
    noLoop();
}

function grapes(x, y, h, w, color) {
    // leaf and stem
    fill('#4B4F4E');
    push();
    translate(x + w / 2, y - h * 1.5)
    rotate(radians(15));
    rect(0, 0, h / 3, w / 1.5);
    pop();

    fill('#F7CD62');
    push();
    translate(x, y - h)
    rotate(radians(300));
    ellipse(0, 0, h / 1.5, w);
    pop();

    // grape
    fill(color);
    for (var i = 0; i < 4; i++) {
        // first and third row
        if ((i === 0) || (i === 2)){
            for (var j = 0; j < 2; j++) {
                ellipse(x + w * j, y + h * i, w, h);
            }
        } else if (i === 1) {
            for (var j = 0; j < 3; j++) {
                ellipse(x + w * (j - 0.5), y + h * i, w, h);
            }
        } else {
            ellipse(x + w * 0.5, y + h * i, w, h);
        }
    }
}

function pattern(x, y, s, type, color) {
    fill(color);
    // oval
    if (type === 1) {
        ellipse(x, y, s * 1.3, s);
    // arc
    } else if (type === 2) {
        arc(x, y, s * 2, s, QUARTER_PI, PI + QUARTER_PI, CHORD);
    // other arc
    } else {
        arc(x, y, s, s, PI + QUARTER_PI, PI * 2 + QUARTER_PI, CHORD);
    }
}

some process coming up with the wall paper design

I started by thinking of a theme. I decided I wanted to do fruit and make it feel playful. Then I came up with some ideas for foreground designs and some abstract shapes for background designs. When making the fruit, the raspberries looked like grapes so I made them grapes instead.

Leave a Reply