xxxxxxxxxx
54
/*
Inspired by Colette and Charles J. Bangert's Complex Intersecting Line (1976)
and Roman Verostko's Sketch (1987)
*/
let startX;
let startY;
let endX;
let endY;
let num = 0;
let total = 100;
let tx = 0;
let ty = 1000;
function setup() {
createCanvas(windowWidth, windowHeight);
stroke(255);
strokeWeight(2);
}
function draw() {
background(0, 20);
// Apply random stroke color and weight every frame
stroke(random(255),random(255),random(255));
strokeWeight(20);
getStartPoint();
getEndPoint();
// Draw line with randomness in position and style
line(startX, startY, endX, endY);
num++;
if (num > total) num = 0; // Reset after drawing total lines
getEndPoint();
}
function getStartPoint() {
startX = map(noise(tx), 0, 1, 0, width);
startY = map(noise(ty), 0, 1, 0, height);
}
function getEndPoint() {
endX = map(noise(tx), 0, 1, 0, width);
endY = map(noise(ty), 0, 1, 0, height);
tx += 0.01;
ty += 0.01;
}