// Yash Mittal
// Section D
function preload(){
Pimg = loadImage ("https://i.imgur.com/PLF0Wbf.jpg"); // load image
}
function setup () {
createCanvas (310, 480);
frameRate (100000000000000);
background (0);
Pimg.resize (310, 480);
}
function draw () {
var a = random (width);
var b = random (height);
var pixela = constrain (floor (a), 0, width - 1);
var pixelb = constrain (floor (b), 0, height - 1);
var sw = random (0, 0.5); // randomising stroke weight
var pixelColorLocationXY = Pimg.get (pixela, pixelb);
strokeWeight (sw); // randomised stroke weight
fill (pixelColorLocationXY);
beginShape (); // making a new hexagonal shape
vertex (a, b);
vertex (a + 4, b);
vertex (a + 7, b + 4);
vertex (a + 5, b + 8);
vertex (a, b + 8);
vertex (a - 2, b + 4);
endShape (CLOSE);
}
For this project, I wanted to develop a somewhat abstract self portrait that is made of hexagonal shapes that appear on screen in a linear fashion.