/* Submitted by: Michal Luria
Section A: 9:00AM - 10:20AM
mluria@andrew.cmu.edu
Assignment-09-Project
*/
var originalImage;
function preload() {
var myImageURL = "http://i.imgur.com/vUZZk6h.jpg"; //image link
originalImage = loadImage(myImageURL); //load image
}
function setup() {
createCanvas(500, 500);
background(0);
originalImage.loadPixels(); //load pixels
frameRate(20000);
}
function draw() {
for (var i = 0; i < 500; i ++){ //draw 500 pixels each frame
var px = random(width); //draw a line in a random x
var py = random(height); //draw a line in a random y
var ix = constrain(floor(px), -20, width-1); //constrain x
var iy = constrain(floor(py), -20, height-1); //contrain y
var theColorAtLocationXY = originalImage.get(ix, iy); //what is the color at a specific location
var curveX1 = random(1,15); //start of curve (X)
var curveX2 = curveX1 + random(1,15); //second point - same direction(X)
var curveX3 = curveX2 + random(1,15); //third point - same direction (X)
var curveY1 = random(1,15); //start of curve (Y)
var curveY2 = curveY1 + random(1,15); //second point - same direction(Y)
var curveY3 = curveY2 + random(1,15); //third point - same direcation(Y)
var strokeSize = random(1,3); //stroke weight random
strokeWeight(strokeSize);
stroke(theColorAtLocationXY); //stroke in the color of pixel
curve(px, py, px+curveX1, py+curveY1, px+curveX2, py+curveY2, px+curveX3, py+curveY3); //draw curve
}
}
In this portrait I wanted to create a feeling of a drawn portrait. To do this, I created random sized curves, in different angles, but all drawn to the same direction to create an artistic style. This is inspired by artists in the impressionist movement. The different sized curves create a sense of brushstrokes, and end up in an image that is not completely clear, but gives a sense of the portrait mood.