//Hannah Kim
//Section A
//hannahk2@andrew.cmu.edu
//Project-09
var img;
var small, big;
function preload() {
var myImageURL = "https://i.imgur.com/7sW6Was.jpg";
img = loadImage(myImageURL);
}
function setup() {
createCanvas(500, 400);
small = 4;
big = 30;
imageMode(CENTER);
noStroke();
background(0);
img.loadPixels();
}
function draw() {
var pointCircle = map(mouseX, 0, 250, small, big);
var pointSquare = map(mouseX, 250, width, small, big);
var x = floor(random(img.width));
var y = floor(random(img.height));
var pix = img.get(x, y);
fill(pix, 100);
if(mouseX<240){
ellipse(x, y, pointCircle, pointCircle);
fill(0);
ellipse(x, y, pointCircle-5, pointCircle-5);
} else {
fill(pix, 100);
rect(x, y, pointSquare, pointSquare);
}
}
There were a few versions I messed around with before coming to my final version. I chose to create a portrait of my sister.
Below is an image of the final result which I felt was the most visually interesting.
Below are my other iterations.
The first one on the bottom was personally my favorite, however I felt it wasnt as interesting as the image above.