xxxxxxxxxx
52
function setup() {
createCanvas(600, 600);
squiggleDamp = 0.2;
myGap = 20;
}
function draw() {
background(220);
let mouseDistance = dist(mouseX, mouseY, width / 2, height / 2) * squiggleDamp;
let mouseAng = atan2( mouseY - height / 2, mouseX - width / 2 ) - 45;
for (let col = 0; col < width; col += myGap) {
for (let row = 0; row < height; row += myGap) {
// push();
// translate(col, row);
// rotate(mouseAng);
// strokeWeight(1)
// line(col, row, 50, 50)
// curve(
// col, row,
// sin(col) * random(mouseDistance),
// cos(row) * random(mouseDistance),
// 0,
// 0,
// cos(row) * random(mouseDistance),
// sin(col) * random(mouseDistance),
// )
strokeWeight(8)
point(col, row, 50)
new myLine(col, row, 50, mouseAng).display
}
}
}
function myLine(x,y,l,r) {
this.x = x;
this.y = y;
this.l = l;
this.r = r;
this.display = function() {
strokeWeight(1)
stroke(255,0,0)
push()
rotate(r)
line(x,y, x+l, y+l)
pop()
}
}