xxxxxxxxxx
72
let coords;
let llen;
let options;
let tempArr;
let refArr;
let mxult;
let ymult;
function setup() {
tempArr = {};
refArr=[];
createCanvas(500, 500);
// createCanvas(windowWidth, windowHeight);
// textAlign(CORNER);x
llen=7
strokeWeight(3)
options = [0,1,2,3]
arrs = []
amt=floor(random(5,60))
xmult=random(1,3)
ymult=random(1,3)
for(let i=0; i < amt; i++){
tempArr = []
tempArr.push(floor(random(-27,4)))
tempArr.push(random(options))
tempArr.push(random(options))
tempArr.push(random(options))
tempArr.push(random(options))
// print(tempArr)
arrs.push(tempArr);
}
}
function draw() {
background(250)
let xdist= abs(mouseX - width/2)*xmult
let ydist= abs(mouseY - height/2)*ymult
// print(ydist)
refArr=[xdist,ydist,width,height];
circsize=map((xdist+ydist)/2,0,width,10,200)
// ellipse(width/2,height/2,circsize,circsize)
for(let i = 0; i < arrs.length; i++){
thisArr=arrs[i]
thickness=thisArr[0];
arg1=thisArr[1];
arg2=thisArr[2];
arg3=thisArr[3];
arg4=thisArr[4];
strokeWeight(thickness)
line(refArr[arg1],refArr[arg2],refArr[arg3],refArr[arg4])
}
// print(arrs);
strokeWeight(1);
}
function keyPressed(){
setup()
}