ablackbu-Project-09-Computational Portrait

Press mouse!!!

sketch

var micah;
var diam = 6;

function preload() {
    //load image
    var image = "https://i.imgur.com/XqeXMOd.png";
    micah = loadImage(image);
}

function setup() {
    createCanvas(300, 300);
    background(0);
    textSize(8);
    textAlign(CENTER);
}

function draw() {
    for(var x = 0; x < width; x+=6){
        for(var y = 0; y < height; y+=6){
            //get pixle color
            var pix = micah.get(x,y);
            strokeWeight(0);
            fill(pix);
            //draw dollar signs collored to var micah
            text("$",x,y);
        }   
    }
}

function mousePressed() {
        //if mouse is pressed, change text size and flash dollar signs
        fill(255);
        textSize(100);
        for(i = 0; i < 5; i++){
            for(j = 0; j < 5; j++){
                text("$",i*80,j*80);  
            }
        }
}

For this project I chose my little brother as the subject. Our family always makes jokes about how much money he spends on clothes so I wanted to create him out of dollar signs. When a key is pressed, a frame flashes and the signs grow so make a more interesting portrait. I decided to steer away from all the examples where dots filled in the image and do something a little different more artistic, and a little more interesting. I feel like I am finally getting a hang of image preloading and the get() function. Hope you enjoy.

Leave a Reply