Yingyang Zhou-Project-09-Portraits

self-portraits

//Yingyang Zhou
//yingyanz@andrew.cmu.edu
//Project-09
//section A

var img;
var randomPos = 0;

function preload(){
  img = loadImage("https://i.imgur.com/GvPS1Fr.jpg");
}

function setup() {
    createCanvas(360, 480);
    background(200);
    // imageMode(CORNER);
    img.loadPixels();
    frameRate(500);
}
function draw(){

  //image(img, 0, 0, width, height);
  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 col = img.get(ix, iy);

  noStroke();
  fill(col);
  var randomSize = random(10);
  ellipse(px, py, randomSize, randomSize);
  stroke(col);
  strokeWeight(2);
  line(px+random(10), py+random(10), px+random(10), py+random(10));
  strokeWeight(1);
  line(px+random(10), py+random(10), px+random(10), py+random(10));
}

ORIGINAL PHOTO
WHAT IT LOOKS LIKE AT THE END

I like this project for a chance to envolve with something we are familiar in our daily life and it provide an interesting to way to look at the common thing in a different way.

Leave a Reply