xxxxxxxxxx
28
// this is actually the number of lines - 1
// make this number bigger for moire patterns
const NUM_LINES = 10;
let x;
let y;
function setup() {
createCanvas(400, 400);
x = width/2;
y = width/2;
}
function draw() {
background(255);
x = mouseX;
y = mouseY;
// x = x + random(-1, 1);
// y = y + random(-1, 1);
for (let i = 0; i <= NUM_LINES; i += 1) {
let startPosX = (width/NUM_LINES)*i;
let startPosY = 0;
line(startPosX, startPosY, x, y);
// uncomment the following lines for fun
// line(startPosY, startPosX, x, y);
// line(width, startPosX, x, y);
// line(startPosX, height, x, y);
}
}