Yugyeong Lee Project – 09

sketch

//Yugyeong Lee
//Section A
//yugyeonl@andrew.cmu.edu
//Project 09

var imgYugy;

function preload() {
	var imgURL = "http://i.imgur.com/XYdrw0f.jpg";
	imgYugy = loadImage(imgURL);

}
function setup() {
    createCanvas(540, 700);
    background(0);

    imgYugy.loadPixels();
    frameRate(500);
}

function draw() {
	drawYugyC();
	drawYugyL();
}

//circular pixels controlled by mouseX and mouseY
function drawYugyC () {
	var pX = mouseX;
	var pY = mouseY;
	var iX = constrain(floor(pX), 0, width - 1);
	var iY = constrain(floor(pY), 0, height - 1);
	var color = imgYugy.get(iX, iY);
	var diam = random(5, 15);

	fill(color);
	noStroke();
	ellipse(pX, pY, diam, diam);
}

//diagonal lines at random
function drawYugyL () {
	var pX = random(0, width);
	var pY = random(0, height);
	var iX = constrain(floor(pX), 0, width - 1);
	var iY = constrain(floor(pY), 0, height - 1);
	var color = imgYugy.get(iX, iY);
	var offset = random(5, 20);
	var strokeweight = random(1, 5)

	stroke(color);
	strokeWeight(strokeweight);
	line(pX, pY, pX + offset, pY + offset);
}

I was exploring on combination of diagonal lines and circles to create a pixelated portrait of myself. The diagonal lines appear at random while circular pixels can be controlled by the location of the mouse.

picture

yugy

Leave a Reply