var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 40;
function makeStringArt(x1, y1, x2, y2, x3, y3, x4, y4) { //function to make string art from points of two lines
line(x1,y1,x2,y2);
line(x3,y3,x4,y4);
dx1 = (x2-x1)/numLines; //changes x value of first point
dy1 = (y2-y1)/numLines; //changes y value of first point
dx2 = (x4-x3)/numLines; //changes x value of second point
dy2 = (y4-y3)/numLines; //changes y value of second point
//initial points
var firstx = x1;
var firsty = y1;
var secondx = x3;
var secondy = y3;
//draws lines and adjusts points for next line
for (var i = 0; i <= numLines; i += 1) {
line(firstx, firsty, secondx, secondy);
firstx += dx1;
firsty += dy1;
secondx += dx2;
secondy += dy2;
}
}
function setup() {
createCanvas(400, 400);
background(218, 190, 229); //purple
}
function draw() {
stroke(255); //white: corner shapes
makeStringArt(0,0,200,0,0,400,0,0);
makeStringArt(200,400,400,400,400,400,400,0);
//quarters of the star shape
stroke(166, 155, 52); //gold
makeStringArt(200,0,200,200,200,200,380,200);
stroke(0, 142, 219) //blue
makeStringArt(200,400,200,200,200,200,380,200);
stroke(166, 155, 52); //gold
makeStringArt(200,400,200,200,200,200,20,200);
stroke(0, 142, 219) //blue
makeStringArt(200,0,200,200,200,200,20,200);
noLoop();
}
Category: Project-04-String-Art
Project 04: String Art
//Julianna Bolivar
//jbolivar
//Section D
//Program: String Art
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;
var numLines = 50;
function setup() {
createCanvas(300, 400);
background(244, 235, 232);
//hot pink
stroke(222, 49, 99);
//right most lines
line(300, 300, 350, 300);
dx1 = (250)/numLines;
dy1 = (290)/numLines;
dx2 = (100)/numLines;
dy2 = (290)/numLines;
//left most lines
dx3 = (150)/numLines;
dy3 = (320)/numLines;
dx4 = (90)/numLines;
dy4 = (90)/numLines;
//overlapping lines
dx5 = (150)/numLines;
dy5 = (320)/numLines;
dx6 = (90)/numLines;
dy6 = (90)/numLines;
}
function draw() {
//right most lines
var x1 = 50;
var y1 = 10;
var x2 = 200;
var y2 = 200;
//left most lines
var x3 = 0;
var y3 = 200;
var x4 = 220;
var y4 = 350;
//overlapping lines
var x5 = 40;
var y5 = 200;
var x6 = 220;
var y6 = 350;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
line(x3, y3, x4, y4);
line(x5, y5, x6, y6);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
x3 -= dx3;
y3 -= dy3;
x4 += dx4;
y4 += dy4;
x5 -= dx5;
y5 -= dy5;
x6 += dx6;
y6 += dy6;
}
noLoop();
}
Mine is quite simple, I wanted to have an interaction or at least have a variety of colors but I couldn’t get it to work in time. I knew I wanted the strings to work vertically, and the overlapping strings was a mistake I ended up liking.
Project 04- String Art
//Catherine Liu
//jianingl
//Section D
var strokeColorR = 255
var strokeColorG = 165
var strokeColorB = 0
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;
var dx7;
var dy7;
var dx8;
var dy8;
var dx9;
var dy9;
var dx10;
var dy10;
var numLines = 50;
function setup() {
createCanvas(400, 300);
background(0);
//draws line that curves downward
line(0,0,width/2,height);
line(width/2,height,width,0);
dx1 = (width/2-0)/numLines;
dy1 = (height-0)/numLines;
dx2 = (width-width/2)/numLines;
dy2 = (0-height)/numLines;
//draws line that curves upward
line(0,height,width/2,0);
line(width/2,0,width,height);
dx3 = (width/2-0)/numLines;
dy3 = (0-height)/numLines;
dx4 = (width-width/2)/numLines;
dy4 = (height-0)/numLines;
//draws line that curves left
line(0,0,width,height/2);
line(width,height/2,0,height);
dx5 = (width-0)/numLines;
dy5 = (height/2-0)/numLines;
dx6 = (0-width)/numLines;
dy6 = (height-height/2)/numLines;
//draws line that curves right
line(width,0,0,height/2);
line(0,height/2,width,height);
dx7 = (0-width)/numLines;
dy7 = (height/2-0)/numLines;
dx8 = (width-0)/numLines;
dy8 = (height-height/2)/numLines;
}
function draw() {
background(0);
stroke(strokeColorR, strokeColorG, strokeColorB);
//draws line that curves downwards
var x1 = 0;
var y1 = 0;
var x2 = width/2;
var y2 = height;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
//draws line that curves upward
var x3 = 0;
var y3 = height;
var x4 = width/2;
var y4 = 0;
for (var i = 0; i <= numLines; i += 1) {
line(x3, y3, x4, y4);
x3 += dx3;
y3 += dy3;
x4 += dx4;
y4 += dy4;
}
//draws line that curves left
var x5 = 0;
var y5 = 0;
var x6 = width;
var y6 = height/2;
for (var i = 0; i <= numLines; i += 1) {
line(x5, y5, x6, y6);
x5 += dx5;
y5 += dy5;
x6 += dx6;
y6 += dy6;
}
//draws line that curves right
var x7 = width;
var y7 = 0;
var x8 = 0;
var y8 = height/2;
for (var i = 0; i <= numLines; i += 1) {
line(x7, y7, x8, y8);
x7 += dx7;
y7 += dy7;
x8 += dx8;
y8 += dy8;
}
}
function mousePressed() {
//checks for R value of color and switches
if (strokeColorR == 255) {
strokeColorR = 0
} else {
strokeColorR = 255
}
//checks for G value of color and switches
if (strokeColorG == 165) {
strokeColorG = 191
} else {
strokeColorG = 165
}
//checks for B value of color and switches
if (strokeColorB == 0) {
strokeColorB = 255
} else {
strokeColorB = 0
}
}
It took me a while to figure out how to use the string to create patterns but once I had a good idea of what I wanted to create it was relatively easy to add strings. I also included the ability for the string to change color when you press the mouse.
Project 4: String art
// Yash Mittal
// Section D
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;
var numLines = 30;
function setup() {
createCanvas(400, 300);
background (0);
stroke (255);
line (70, 200, 180, 10); // reference line 1
line (330, 180, 290, 70); // reference line 2
strokeWeight (0);
line (150, 290, 250, 260); // reference line 3
line (100, 100, 200, 200); // reference to line 4
stroke ("white");
line (30, 70, 290, 110); // reference to line 5
strokeWeight (1);
line (20, 20, 110, 10); // reference to line 6
dx1 = (180 - 70) / numLines;
dy1 = (10 - 200) / numLines;
dx2 = (290 - 330) / numLines;
dy2 = (70 - 180) / numLines;
dx3 = (250 - 150) / numLines;
dy3 = (260 - 290) / numLines;
dx4 = (200 - 100) / numLines;
dy4 = (200 - 100) / numLines;
dx5 = (290 - 30) / numLines;
dy5 = (110 - 70) / numLines;
dx6 = (110 - 20) / numLines;
dy6 = (10 - 20) / numLines;
}
function draw() {
var x1 = 70;
var y1 = 200;
var x2 = 330;
var y2 = 180;
var x3 = 150;
var y3 = 290;
var x4 = 100;
var y4 = 200;
var x5 = 30;
var y5 = 290;
var x6 = 20;
var y6 = 20;
var x7 = 110;
var y7 = 10;
for (var i = 0; i <= numLines; i = i + 0.9) { // center lines (left to right)
line (x1, y1, x2, y2);
x2 = x2+ dx2;
y2 = y2 + dy2;
}
stroke ("yellow");
for (var i2 = 0; i2 <= numLines; i2 = i2 + 3) { // bottom lines (bottom left to top)
line (x2, y2, x3, y3);
x2 = x2 + dx3;
y2 = y2 + dy3;
x3 = x3 + dx3;
y3 = y3 + dy3;
}
stroke ("white");
for (var i5 = 0; i5 <= numLines; i5 = i5 + 0.5) {
line (x4, y4, x5, y5);
x5 = x5 + dx5;
y5 = y5 + dy5;
}
stroke ("red");
for (var i3 = 0; i3 <= numLines; i3 = i3 + 1) { // top lines (top right to top center)
line (x2, y2, x1, y1);
x2 = x2 + dx3;
y2 = y2 + dy3;
x1 = x1 + dx1;
y1 = y1 + dy1;
}
for (var i4 = 0; i4 <= numLines; i4 = i4 + 0.1) {
line (x3, y3, x2, y2);
x3 = x3 + dx3;
y3 = y3 + dy3;
x2 = x2 + dx2;
y2 = y2 + dy2;
}
stroke ("yellow");
strokeWeight (0.4);
for (var i6 = 0; i6 <= numLines; i6 = i6 + 0.8) {
line (x1, y1, x3, y3);
x1 = x1 + dx1 / 2;
y1 = y1 + dx1 / 2;
x3 = x3 + dx3 / 2;
y3 = y3 + dy3 / 2;
}
stroke ("red");
for (var i7 = 0; i7 <= numLines; i7 = i7 + 0.5) {
line (x6, y6, x4, y4);
x4 = x4 + dx4;
y4 = y4 + dy4;
}
strokeWeight (0.3);
stroke ("red");
for (var i8 = 0; i8 <= numLines; i8 = i8 + 0.1) {
line (x7, y7, -x4, y4);
x7 = x7 + dx6;
y7 = y7 + dx6;
}
noLoop();
}
I had fun working on this project. At first, I struggled to understand the mathematics behind the code but once I got the hang of it, it became pretty easy to draw new patterns on different parts of the canvas.
String Art
var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 50;
function setup() {
createCanvas(400, 400);
background(220);
}
function draw() {
background(200);
//line(mouseX, mouseX, 150-mouseY, 300+mouseY);
//line(mouseX, mouseX, 350-mouseY, 100+mouseY);
var x1 = mouseX;
var y1 = mouseX;
var x2 = mouseX;
var y2 = mouseX;
dx1 = (mouseX-mouseY)/numLines;
dy1 = (mouseX-mouseY)/numLines;
dx2 = (150-mouseY-350-mouseY)/numLines;
dy2 = (300+mouseY-100+mouseY)/numLines;
for (var i = 0; i <= numLines; i += 1) {
stroke(0);
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
var r = 20;
fill(255,140,140);
noStroke();
circle(mouseY, mouseX, 2*r);
fill(140,140,255);
circle(width-mouseY, height-mouseX, 40);
var xc1 = mouseY;
var yc1 = mouseX+r;
var xc2 = width-mouseY;
var yc2 = height-mouseX-r;
for (var i = 0; i <= 2*PI; i += PI/4) {
stroke(0);
line(xc1, yc1, xc2, yc2);
if (i <= PI/2) {
xc1 += r*Math.sin(i);
yc1 -= r-r*Math.cos(i);
xc2 -= r*Math.sin(i);
yc2 += r-r*Math.cos(i);
} else if (i > PI/2 & i <= PI) {
xc1 -= r*Math.sin(i);
yc1 -= r-r*Math.cos(i);
xc2 += r*Math.sin(i);
yc2 += r-r*Math.cos(i);
} else if (i > PI & i <= 3*PI/2) {
xc1 -= r*Math.sin(i);
yc1 += r-r*Math.cos(i);
xc2 += r*Math.sin(i);
yc2 -= r-r*Math.cos(i);
} else if (i > 3*PI/2 & i <= 2*PI) {
xc1 += r*Math.sin(i);
yc1 += r-r*Math.cos(i);
xc2 -= r*Math.sin(i);
yc2 -= r-r*Math.cos(i);
}
}
}
String Art
var dx1;
var dy1;
var dx2;
var dy2;
function setup() {
createCanvas(400, 300);
background(200);
}
function draw() {
drawLines(0, 50, 400, 200, 150, 300, 100, 100, 50);
drawLines(100, 0, 300, 300, 150, 200, 350, 100, 50);
drawLines(0, 200, 300, 100, 300, 300, 400, 300, 50);
drawLines(350, 100, 300, 200, 150, 300, 350, 100, 50);
noLoop();
}
function drawLines(x1, y1, x2, y2, x3, y3, x4, y4, numLines) {
dx1 = (x3-x1)/numLines;
dy1 = (y3-y1)/numLines;
dx2 = (x4-x2)/numLines;
dy2 = (y4-y2)/numLines;
line(x1, y1, x3, y3);
line(x2, y2, x4, y4);
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
}
Although my art isn’t super cool, I’m glad that I was able to write a method to draw shapes. Now I can spam it as many times as I want and just put in the parameters for where the lines should start and end 🙂
Project 4: String Art
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var numl = 40;//linenumber
var sw = 0.5;//strokeweight
function setup(){
createCanvas(300,400);
}
function draw(){
background(0);
strokeWeight(1);
//reference red
stroke(183,58,66);
line(10,10,50,250);
line(250,10,250,350);
line(50,250,250,350);
dx1 = (50-10)/numl;
dy1 = (250-10)/numl;
dx2 = (250-250)/numl;
dy2 = (350-10)/numl;
dx3 = (250-50)/numl;
dy3 = (350-250)/numl;
//defineshape
var x1 = 10;
var y1 = 10;
var x2 = 250;
var y2 = 10;
var x3 = 50;
var y3 = 350;
//drawlines
for (var c = 0; c <= numl; c = c + 1){
stroke(255,0,0);
strokeWeight(sw);
//squarelinepath
line(x1,y1,x2,y2);
//trianglelinepath
line(x2,y1,x1,x2);
//curvepath
line(x3,y1,x2,y2);
//rect
line(x1,y1,x2,y1);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
x3 += dx3;
y3 += dy3;
//interaction:changeslineform
if (mouseIsPressed){
x1 += 1;
y1 += 1;
x2 += 3;
y2 += 2;
x3 += 3;
y3 += 3;
}
}
}
I enjoyed coding this project because by changing a few variables, I get to create different interesting compositions. Compared to the previous projects, I feel like this one is more intuitive than planned. During the process, I faced difficulty understanding what each variable does. However, after looking at some examples and experimenting, I understood my variables better and was able to alter them to achieve the effects I wanted.
Project 04: String Art
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;
var dx7;
var dy7;
var dx8;
var dy8;
var numLines = 30;
var numLines2 = 40;
var numLines3 = 50;
var numLines4 = 60;
function setup() {
createCanvas(400, 300);
background(179,212,177);
line(100, 50, 150, 250);
dx1 = (150-75)/numLines;
dy1 = (70-50)/numLines;
dx2 = (250-150)/numLines;
dy2 = (300-250)/numLines;
line(400,0,400,300);
dx3 = (400-0)/numLines2;
dy3 = (0-300)/numLines2;
dx4 = (400-400)/numLines2;
dy4 = (300-0)/numLines2;
line(100, 50, 50, 125);
dx5 = (100-50)/numLines3;
dy5 = (125-50)/numLines3;
dx6 = (350-300)/numLines3;
dy6 = (200-25)/numLines3;
//line(50, 50, 50, 150);
line(400, 100, 400, 300);
dx7 = (400-50)/numLines4;
dy7 = 50/numLines4;
dx8 = (400-50)/numLines4;
dy8 = (300-150)/numLines4;
}
function draw() {
//yellow sunlight ray from upper right hand corner
var x3 = 375;
var y3 = 15;
var x4 = 0;
var y4 = 130;
for (var a = 0; a <= numLines2; a += 1) {
stroke(255,255,102);
line(x3, y3, x4, y4);
x3 += dx3;
y3 += dy3;
x4 += dx4;
y4 += dy4;
}
//green twisty shape that aligns with orange ray
var x7 = 150;
var y7 = 250;
var x8 = 250;
var y8 = 200;
for (var c = 0; c <= numLines4; c += 2) {
stroke(51,102,0);
line(x7, y7, x8, y8);
x7 -= dx7;
y7 -= dy7;
x8 += dx8;
y8 += dy8;
}
//blue "parallelogram" shaped solar panel
var x1 = 100;
var y1 = 50;
var x2 = 150;
var y2 = 250;
for (var i = 0; i <= numLines; i += 1) {
stroke(0, random(90, 105), random(195, 210));
line(x1, y1, x2, y2);
x1 += dx1;
y1 -= dy1;
x2 += dx2;
y2 -= dy2;
}
//orange ray from upper right left corner
var x5 = 0;
var y5 = 0;
var x6 = 500;
var y6 = 150;
for (var b = 0; b <= numLines3; b += 1) {
stroke(255,153,51);
line(x5, y5, x6, y6);
x5 -= dx5;
y5 += dy5;
x6 += dx6;
y6 += dy6;
}
noLoop();
}
I knew that the string “rays” reminded me of sunlight and spotlights, so from there I wanted to add in something (the panel) that would make sense. Given that a lot of solar panels are just above grass, I made the background light green and put a dark green string element just below it.
Project: String Art
//Jacky Lococo
//jlococo
//Section C
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;
var dx7;
var dy7;
var dx8;
var dy8;
var dx9;
var dy9;
var dx10;
var dy10;
var dx11;
var dy11;
var dx12;
var dy12;
var numLines = 50;
var numLines2 = 25;
function setup() {
createCanvas(400, 400);
//peach upper shape
// line(150, 50, 50, 300); //guiding lines to help visualize
// line(250, 50, 350, 300);
dx1 = (50-150)/numLines;
dy1 = (300-50)/numLines;
dx2 = (350-250)/numLines;
dy2 = (300-50)/numLines;
//peach lower shape
// line(150, 350, 50, 100)//guiding lines
// line(250, 350, 350, 100)
dx3 = (50-150)/numLines
dy3 = (100-350)/numLines
dx4 = (350-250)/numLines
dy4 = (100-350)/numLines
//white spiral in the middle of canvas
// line(200, 70, 40, 200); //guiding lines
// line(40, 200, 200, 360);
dx5 = (40-200)/numLines;
dy5 = (200-70)/numLines;
dx6 = (200-40)/numLines;
dy6 = (360-200)/numLines
//burgundy bowtie shape in the back of comp
// line(200, 0, 400, 200) //guiding lines
// line(500, 300, 100, 400)
dx7 = (400-300)/numLines
dy7 = (100-0)/numLines
dx8 = (100-0)/numLines
dy8 = (400-300)/numLines
//top left corner lines
// line(150, 0, 0, 100) //guiding lines
dx9 = (0-150)/numLines
dy9 = (100-0)/numLines
dx10 = (0)/numLines
dy10 = (0)/numLines
//bottom right corner lines
// line(250, 400, 400, 300) //guiding lines
dx11 = (400-250)/numLines
dy11 = (300-400)/numLines
dx12 = (0)/numLines
dy12 = (0)/numLines
}
function draw() {
background(255, 63, 24);
//this is the bowtie shape in the back of the composition
var x7 = 300;
var y7 = 0;
var x8 = 100;
var y8 = 400;
for (var i = 0; i <= numLines; i += 1) {
stroke(80, 13,0)
line(x7, y7, x8, y8);
x7 += dx7;
y7 += dy7;
x8 -= dx8;
y8 -= dy8;
}
//upper peach colored upper curve
var x1 = 150;
var y1 = 50;
var x2 = 350;
var y2 = 300;
for (var i = 0; i <= numLines; i += 1) {
stroke(255, 148, 108)
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 -= dx2;
y2 -= dy2;
}
//lower peach colored curve
var x3 = 150;
var y3 = 350;
var x4 = 350;
var y4 = 100;
for (var i = 0; i <= numLines; i += 1) {
stroke(255, 148, 108)
line(x3, y3, x4, y4);
x3 += dx3;
y3 += dy3;
x4 -= dx4;
y4 -= dy4;
}
//white spiral in the middle dividing the canvas
var x5 = 200;
var y5 = 70;
var x6 = 200;
var y6 = 360;
for (var i = 0; i <= numLines; i += 1) {
stroke(255, 235, 238)
line(x5, y5, x6, y6);
x5 += dx5;
y5 += dy5;
x6 += dx6;
y6 -= dy6;
}
//upper left corner lines
var x9 = 150;
var y9 = 0;
var x10 = 0;
var y10 = 0;
for (var i = 0; i <= numLines; i += 1) {
stroke(255)
line(x9, y9, x10, y10);
x9 += dx9;
y9 += dy9;
x10 += dx10;
y10 -= dy10;
}
//bottom right corner lines
var x11 = 250;
var y11 = 400;
var x12 = 400;
var y12 = 400;
for (var i = 0; i <= numLines; i += 1) {
stroke(255)
line(x11, y11, x12, y12);
x11 += dx11;
y11 += dy11;
x12 += dx12;
y12 += dy12;
}
//Inner circles, radius decreases by 5 for each
//largest circle
stroke(255)
strokeWeight(1)
fill(80, 13, 0)
ellipse(200, 200, 50, 50)
stroke(255)
strokeWeight(1)
fill(80, 13, 0)
ellipse(200, 200, 45, 45)
stroke(255)
strokeWeight(1)
fill(80, 13, 0)
ellipse(200, 200, 40, 40)
//smallest circle
stroke(255)
strokeWeight(1)
fill(80, 13, 0)
ellipse(200, 200, 35, 35)
noLoop()
}
This project was a little bit difficult, I think I mainly approached it by trying to find patterns within the code given and use that to make any desired shapes. Once I got the hang of the process and why certain numbers were used, it became a lot easier.
Project-04: String Art
var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 20;
function setup() {
createCanvas(400, 300);
background(0);
//setting up star shaped template
rectMode(CENTER);
fill(50);
noStroke();
// stroke(255,0,0);
push();
translate(200, 150);
rotate(radians(45));
rect(0, 0, 200, 200);
pop();
translate(200, 150);
rect(0, 0, 200, 200);
//increments
dx1 = (100-100)/numLines;
dy1 = (250-200)/numLines;
dx2 = (340-200)/numLines;
dy2 = (151-291)/numLines;
}
function draw() {
stroke(255);
// reference: line(100, 50, 100, 250);
// reference: line(200, 291, 340, 151);
//line1_top left to bottom center
var x1 = 100;
var y1 = 50;
var x2 = 200;
var y2 = 291;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += -dx2;
y2 += dy2;
}
//line 2_bottom left to right center
var x1 = 100;
var y1 = 250;
var x2 = 340;
var y2 = 151;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += -dy1;
x2 += -dx2;
y2 += -dy2;
}
//line3_bottom right to top center
var x1 = 300;
var y1 = 250;
var x2 = 200;
var y2 = 10;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += -dy1;
x2 += dx2;
y2 += -dy2;
}
//line 4_top right to left center
var x1 = 300;
var y1 = 50;
var x2 = 60;
var y2 = 151;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
noLoop();
}
//line 5_top left to top center
var x1 = 100;
var y1 = 50;
var x2 = 200;
var y2 = 10;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += -dx2;
y2 += -dy2;
noLoop();
}
//line 6_bottom right to bottom center
var x1 = 300;
var y1 = 250;
var x2 = 200;
var y2 = 290;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += -dy1;
x2 += dx2;
y2 += dy2;
noLoop();
}
}
I really enjoy creating geometric patterns, so it was really intriguing for me to learn how I can modify the increments and number of lines to create a pattern.