Project 5 – Wallpaper

The famous Coca-Cola bottle and its mascot, the polar bear, were my inspiration for this wallpaper. I first digitally sketched a Coca-Cola bottle to use as a template, as shown at the bottom, and then, I added some polar bears as decoration.

sketch
/* Michelle Kim
 * michell4
 * Section B
 */

function setup() {
    createCanvas(600, 600);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    background(255, 244, 196);
    //cola
    for(var x = 75; x < width; x += 200) {
        for(var y = 50; y < height; y += 220) {
            push();
            translate(x, y);
            cola();
            pop();
        }
    }
    //polar bear
    for(var a = -40; a < width; a += 200) {
        for(var b = 20; b < height; b += 220) {
            push();
            translate(a, b);
            bear();
            pop();
        }
    }
}

function cola() {
    push();
    scale(0.5);
    //bottle
    fill(193, 252, 255);
    noStroke();
    rect(0, 0, 40, 70);
    quad(40, 65, 0, 65, -12, 95, 52, 95);
    ellipse(20, 130, 75, 125);
    quad(-13, 160, 53, 160, 40, 190, 0, 190);
    quad(45, 190, -5, 190, -18, 225, 58, 225);
    arc(20, 280, 95, 200, radians(170), radians(10), CHORD);
    noFill();
    stroke(223, 248, 255);
    strokeWeight(12);
    arc(-7, 58, 25, 50, 0, radians(60));
    arc(47, 58, 25, 50, radians(120), radians(180));
    arc(-15, 185, 23, 75, radians(283), radians(80));
    arc(55, 185, 23, 75, radians(100), radians(256));
    arc(20, 287, 82, 15, 0, radians(180));
    //soda
    fill(68, 32, 10);
    noStroke();
    arc(20, 90, 40, 200, radians(340), radians(200), CHORD);
    arc(11, 125, 40, 100, radians(80), radians(255));
    arc(29, 125, 40, 100, radians(285), radians(100));
    rect(0, 165, 40, 50);
    arc(20, 278, 75, 178, radians(170), radians(10), CHORD);
    arc(20, 284, 74, 21, 0, radians(180));
    noFill();
    stroke(68, 32, 10);
    strokeWeight(12);
    arc(-7, 183, 23, 80, radians(290), radians(80));
    arc(47, 183, 23, 80, radians(100), radians(250));
    //cap
    fill(170, 0, 0);
    noStroke();
    rect(0, 0, 40, 16);
    circle(1, 8, 15);
    circle(39, 8, 15);
    //label
    rect(-15, 110, 70, 40);
    noFill();
    stroke(170, 0, 0);
    strokeWeight(5);
    arc(-11, 130, 8, 55, radians(100), radians(260));
    arc(51, 130, 8, 55, radians(280), radians(80));
    //bubbles
    fill(200);
    noStroke();
    circle(23, 95, 10);
    circle(33, 100, 5);
    circle(37, 91, 7);
    circle(10, 160, 5);
    circle(25, 168, 8);
    circle(12, 180, 13);
    circle(27, 183, 5);
    circle(0, 270, 5);
    circle(-7, 280, 10);
    circle(40, 260, 15);
    circle(25, 270, 7);
    circle(45, 275, 5);
    pop();
}

function bear() {
    push();
    //polar bear ears
    fill(255);
    noStroke();
    circle(5, -12, 20);
    circle(45, -12, 20);
    fill(220);
    circle(5, -12, 10);
    circle(45, -12, 10);
    //polar bear body
    fill(255);
    rect(0, 0, 50, 70);
    arc(25, 0, 50, 40, radians(180), 0);
    circle(-5, 45, 15);
    circle(45, 46, 50);
    circle(70, 45, 15);
    noFill();
    stroke(255);
    strokeWeight(5);
    arc(60, 10, 25, 35, radians(110), radians(190));
    line(3, 0, 1, 40);
    fill(255);
    arc(52, 45, 46, 50, radians(0), radians(120));
    arc(5, 45, 30, 50, radians(60), radians(175));
    ellipse(28, 65, 25, 10);
    //polar bear outlines
    fill(220);
    noStroke();
    circle(63, 47, 4);
    circle(70, 47, 4);
    circle(72, 53, 4);
    circle(62, 58, 12);
    noFill();
    stroke(220);
    strokeWeight(2);
    arc(-7, 46, 10, 50, radians(300), radians(80));
    arc(1, 65, 10, 15, radians(130), radians(190));
    arc(13, 46, 10, 50, radians(300), radians(80));
    arc(21, 65, 10, 15, radians(130), radians(190));
    arc(38, 46, 10, 50, radians(300), radians(80));
    arc(46, 65, 10, 15, radians(130), radians(190));
    arc(67, 52, 30, 30,radians(205), radians(272));
    //polar bear face
    fill(220);
    noStroke();
    circle(25, 10, 18);
    fill(0);
    circle(13, 0, 6);
    circle(37, 0, 6);
    ellipse(25, 7, 7, 5);
    noFill();
    stroke(0);
    strokeWeight(1);
    arc(23, 10, 4, 8, 0, radians(130));
    arc(27, 10, 4, 8, radians(50), radians(180));
    pop();
}

Leave a Reply