Nina Yoo- Project 09- Portrait

sketch


var underlyingImage;
var words = ['bee','key','lee','see','me','knee','allie','nina','i','love'];

function preload() {
    var myImageURL ="https://i.imgur.com/3K9LA06.png"
    underlyingImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(500, 500);
    background(0);
    underlyingImage.loadPixels();
    frameRate(100);
}

var x = -5;

function draw() {
	x += 5;
	for (y = 0; y <height; y+= 10) {
		var theColorAtLocationXY = underlyingImage.get(x,y);
		fill(theColorAtLocationXY);
		rect(x,y,10,10);

	}
    var px = random(width);
    var py = random(height);
    var ix = constrain(floor(px), 0, width-1);
    var iy = constrain(floor(py), 0, height-1);
    var theColorAtLocationXY = underlyingImage.get(ix, iy);

    noStroke();
    fill(theColorAtLocationXY);

    var randomwor = words[round(random(0,words.length))];
    print(randomwor);
    text(randomwor,ix,iy);
  
}

This project was super fun in playing with different ways to load an image. I loved to figure out how to put on the words and create a sweeping image. It was cool to upload an image, but also see the process of developing the pixels.

Leave a Reply