# atraylor – Project 09 – Section B

//atraylor@andrew.cmu.edu
//project 09
//Section B

var face = "https://i.imgur.com/q6OIZVm.jpg";
var imScale = 10;
var offset = [];
var step = [];
}
function setup() {
createCanvas(480, 480);
background(220);
for(var i = 0; i < 2400; i++){
offset.push(random(-2, 2));
step.push(random(-100, 100));
}
}
function draw() {
pixelDensity(1);
// Render the current image to the canvas.
image(currentImage, 0, 0);
background(230);

for (var y = 0; y < currentImage.height; y++){ // y location of pixels
for (var x = 0; x < currentImage.width; x++) { // x location of pixels
var index = (x + y * currentImage.width) * 4; // to analyze the rgba values in the pixels

var p = []; // the pixel array
p[0] = currentImage.pixels[index]; // r
p[1]= currentImage.pixels[index+1]; // g
p[2] = currentImage.pixels[index+2]; // b
p[3] = currentImage.pixels[index+3]; // a

var brightP = brightness(p);
//draw "pixels"
fill(brightP);
strokeWeight(.09);
rect(x* imScale + noise(offset[x]), y* imScale + noise(offset[y]), imScale, imScale);
offset[x] += step[x];
offset[y] += step[y];
}
}
}

Here is a digital portrait of me and my sister, or my sister and me? We’re two years apart but people, to our confusion, always think we’re twins. We did a face-swap one day and it was hilarious: we didn’t seem to change at all.