# Project 08: Generative Portrait

For this project, I chose to render my brother. I originally had wanted to use particle systems to create a water-like simulation on top of the loaded pixels using a mutual repulsion force. In this sketch, however, I used a gaussian distribution to create a black hole in which the array of tiny pixel ellipses would form and disappear. The sketch did not turn out as I had hoped since I did not use a gradually added velocity and just layered the gaussian particles on top of the grid, and used too many ellipses in the for loops. This made the transition abrupt and the program slow.

var img;
var colorXY;

}

function setup() {

createCanvas(800, 700);
stroke(255);
}

function draw () {
background(0);

var tw = 5
var th = 5
var ay = 0
var ax = 0

for (var y = 0; y <= 200; y++) {
for (var x = 0; x <= 160; x++) {
var py = ay + y * th;
var px = ax + x * tw;
colorXY = img.get(px, py);
noStroke();
fill(colorXY);
ellipse(randomGaussian(width/2, mouseX), randomGaussian(width/2, 50), 5, 5);
if (mouseX <= width/2) {
ellipse(px, py, 5,5);
}
}
}
//drawCircles (width/2, height/2, 50);
}

/*function drawCircles (x, y, distance) {

var px = random(width);
var py = random(height);
var ix = constrain(floor(px), 0, width-1);
var iy = constrain(floor(px), 0, height-1);

colorXY = img.get(ix, iy)
noStroke();
fill(colorXY);
ellipse(x + distance, y + distance, 10, 10);
noLoop();
if (distance > 2) {
distance *= 0.95
drawCircle(x, y, distance)

}
}
*/