sketch
// Bridget Doherty, bpdohert, 104 Section C
// draw at least 3 string art shapes
var dx1;
var dy1;
var dx2;
var dy2;
// line density
var numLines = 40;
// starting line values
var x1 = 0;
var y1 = 0;
var x3 = 0;
var y3 = 300;
// second line values
var x2 = 400;
var y2 = 300;
var x4 = 400;
var y4 = 0;
var mouseClick = 0;
function setup() {
createCanvas(400, 300);
background('black');
blendMode(EXCLUSION);
}
function draw() {
drawCircles();
string1();
string2();
string3();
noLoop();
}
function drawCircles() {
for (i = 20; i < width; i+= 40) {
fill(250);
noStroke();
circle(i*1.3, i, 40);
}
}
function string1() {
for(i = 0; i <= height; i += 10) {
stroke('green');
line(width/2.5, height/2, 0, i);
line(width/2.5, height/2, width, i);
}
for(i = 0; i <= width; i += 10){
stroke('yellow');
line(width/3 + width/2, height/2, 0, i);
line(width/3 + width/2, height/2, width, i);
}
}
function string2() {
stroke('blue');
dx1 = (300-50)/numLines;
dy1 = (0)/numLines;
dx2 = (50-300)/numLines;
dy2 = (300-300)/numLines;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
}
function string3() {
stroke('cyan');
dx1 = (300-50)/numLines;
dy1 = (0)/numLines;
dx2 = (50-300)/numLines;
dy2 = (300-300)/numLines;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
}