xxxxxxxxxx
67
/*
Inspired by Colette and Charles J. Bangert's Complex Intersecting Line (1976) and Roman Verostko's Sketch (1987)
*/
//init variables
let startX;
let startY;
let endX;
let endY;
let num = 0;
let total = 1000;
let tx = 0;
let ty = 1000;
//setup function init
function setup() {
//resizable canvas with window size
createCanvas(windowWidth, windowHeight);
//background black
background(0);
//outline white
stroke(255);
//outline width 2
strokeWeight(2);
//call find start and end point functions
getStartPoint();
getEndPoint();
}
//draw loop start
function draw() {
//while loop when num(0) is less than total(1000)
while (num < total) {
//draw line with variable values for start and end
line(startX, startY, endX, endY);
//set new start to previous end
startX = endX;
startY = endY;
//find new end point with function
getEndPoint();
//add 1 to num (until reaches 1000)
num++;
}
}
//find start point function
function getStartPoint() {
//scale noise value to the canvas size (height and width). X will start closer to 0 and Y will start closer to the edge of the canvas size
startX = map(noise(tx), 0, 1, 0, width);
startY = map(noise(ty), 0, 1, 0, height);
}
//find end point function
function getEndPoint() {
//scale noise value to the canvas size (height and width). X will end closer to 0 and Y will end closer to the edge of the canvas size
endX = map(noise(tx), 0, 1, 0, width);
endY = map(noise(ty), 0, 1, 0, height);
console.log(tx);
console.log(ty);
console.log(endX);
console.log(endY);
tx += 0.01;
ty += 0.01;
}