Lauren Park – Project 09 – Portrait

sketch

//Lauren Park
//Section D
//ljpark@andrew.cmu.edu
//Assignment-09
var selfportrait;

function preload() {
//load image
  var imageURL = "https://i.imgur.com/Z0Egws0.jpg";
  selfportrait = loadImage(imageURL);
}

function setup() {
  createCanvas(480, 480);
  background(0);
//load pixels at a rate
  frameRate(200);
  selfportrait.loadPixels();  
}

function draw() {
 var px = random(width);
 var py = random(height);
  
 var qx = constrain(floor(px), 0, width);
 var qy = constrain(floor(py), 0, height);
  
 var colorMylocation = selfportrait.get(qx, qy);
 var colorMymouse = selfportrait.get(mouseX, mouseY);
  
//fill and color pixels with text
 strokeWeight(3);
 fill(colorMylocation);
 text("Lauren", px, py);
  
//draw and color ellipse at my mouse location
 fill(colorMymouse);
 noStroke();
 ellipse(pmouseX, pmouseY, 8, 8);
}

For this project, I decided to make a computational self-portrait using my name in text to create and color the image. Adding my name I think adds another personal element that goes along with my self-portrait and I also wanted to incorporate using the mouse to load the pixels, using ellipses, in the picture faster.

Leave a Reply