Min Jun Kim -Project 4 String Art

sketch

/*
Min Jun Kim
minjunki@andrew.cmu.edu
15104-B
Project 4
*/

function setup() {
    createCanvas(400, 300);
}

function draw() {
	background(0);
	//Thickness of Strokes of points
	strokeWeight(0.5);
	//color of strokes
	stroke(100,150,150);
	translate(width/2,height/2);
	rotate(3.95);

	for (var i = 0; i<500; i += 19) {
		//first large oval sideways settings
		var x = 140*sin(i);
		var y = 100*cos(i);
		//small circle settings in middle
		var eye1x = 50*sin(i*2);
		var eye1y = 50*cos(i*2);
		//draws the points outline for all drawn shapes
		point(x,y);
		point(y,x);
		point(eye1x,eye1y);
		
		//draws the lines on the vertial line
		for (var v = -200; v<201; v += 50) {
			stroke(100,150,150);
			line(-200,v,x,y);
			line(200,v,x,y);	
		} 
		//draws the lines on the horizontal line
		for (var f = -200; f<201; f += 50) {
			line(f,-200,y,x);
			line(f,200,y,x);
			//draws lines starting from middle to the small circle
			line(0,0,eye1x,eye1y);
			line(0,0,eye1x,eye1y);
		}
		
	}
}



I started off by drawing some points using the “for” loops. I used sine and cosine to draw points along circles. This helped me visualized where the lines will go. I then used nested “for” loops to draw the lines. The lines went along all sides of the canvas and I thought that it looked well. I was messing around with the variables and the end result turned out to be an upside-down tilted heart. I then translated to the middle of the canvas in order to rotate it, then converted all the variables to scale properly. All in all, I thought the project really taught me how to use for loops.

Leave a Reply