Alexandra Kaplan – Project 09

sketch

/*
Alexandra Kaplan
aekaplan@andrew.cmu.edu
Section C
Project - 09
*/

var img; //image
var w; //width of balloons

function preload () {
    img = loadImage("https://i.imgur.com/0F4euVwm.jpg?2") //loads image
}

function setup() {
    createCanvas(320, 315);
    background(0);
    noStroke();
    img.loadPixels(); // loads pixels
    frameRate(200); // fast
}

function draw() {

    var x = floor(randomGaussian(width / 2, 75)); // draws balloons concentrated in the center
    var y = floor(randomGaussian(height / 2, 75)); // draws balloons concentrated in the center
    var col = color(img.get(x, y)); 
    var d = dist(x, y , width / 2, height / 2);
    w = map(d, 0, width, 1, 10); // balloons in center are smaller than edge
    fill(col); // fill is color of image at x and y
    stroke(col); // stroke color is color of image at x and y
    balloon(x, y, w, w); // draws balloon
}

function balloon(x, y, w){
	strokeWeight(0.5);
	line(x - (w / 12), y, x - (w / 12), y + (w * 2)); // draws balloon string
	strokeWeight(0);
	ellipse(x, y, w, w); // draws filled up balloon 
	triangle(x - (w / 4), y + (w / 1.5), x + (w / 4), y + (w / 1.5), x, y); // draws balloon nubbin
}

I had a lot of fun finding a picture for this project, and I ended up going with a photo I took of my housemate at the end of last year when we filled up another housemate’s room with balloons. For the computational image, I decided that it should be made up of balloon shaped pixels. The pixels are bigger and more concentrated in the center (and therefore a higher resolution) and bigger and less concentrated on the outskirts.

Beginning of image
Closer to end of image
Original Image

Leave a Reply