// Emmanuel Nwandu
// enwandu@andrew.cmu.edu
// Section D
// Project-04-String Art
var distribution = new Array(360);
function setup() {
createCanvas(400, 300);
for(i = 0; i < 275; i++){
// Controls the properties of the line
distribution[i] = floor(randomGaussian(350, 200));
}
}
function draw() {
background(0);
// Generates a set of random lines radiating from the center of the canvas
push();
translate(width/2, height/2);
for(i = 0; i < 275; i++){
rotate(TWO_PI/275);
stroke(200, 0, 0);
var dist = abs(distribution[i]);
line(0, 0, dist, 0)
}
pop();
var xBound = width;
var yBound = height;
var x = 0;
var y2 = 0;
strokeWeight(1)
stroke(0); // Controls the color of the
// Generates lines which form an arc that moves diagonally
// across the canvas to each corner
// Similar geometry to the Mangekyou Sharigan
for(i = 0; i < xBound; i +=10){
var y = i * 3/4;
line(x, y, i, yBound); //Lower left arc
line(x, yBound -y, i, y2); // Upper Left arc
line(xBound, y, xBound - i, yBound); // Lower Right arc
line(i, y2, xBound, y); // Upper Right arc
}
// Draws pupil
fill(0);
ellipse(200, 150, 75, 75);
}
This week, I was a bit unsure how to approach the assignment. I initially began coding random lines, to simply get a feel for what a happened when I manipulated certain parts of the code. This was extremely helpful, and while my code does not reflect all I wanted to achieve with this assignment, I learnt a lot by playing around with it a bit.
I drew inspiration from the Sasuke Uchiha’s Mangekyou Sharigan. It has been cropped, or zoomed in order to simplify it a bit. I had trouble coding the center petals of the floral pattern seen in his eye. It was a cool project though, definitely want to explore this more.