const resiliency = -0.025;
createCanvas(windowWidth, windowHeight);
[main, columns, rows] = makeGrid();
arr.forEach(elem=>{curveVertex(elem.pos.x, elem.pos.y)})
arr.forEach(elem=>{curveVertex(elem.pos.x, elem.pos.y)})
ellipse(mouseX, mouseY, 20);
function mouseDragged() {
function mousePressed() {
let mouse = createVector(mouseX, mouseY);
let diff = elem.pos.copy().sub(mouse);
let distance = diff.mag();
let multi = pow(2, -(distance * mousePower));
for (let i = 0; i < width; i += blockSize) {
for (let j = 0; j < height; j += blockSize) {
arr.push(new Point(i, j));
for (let i = 0; i < width; i += blockSize) {
const column = arr.filter((elem) => elem.supposed.x == i);
for (let j = 0; j < height; j += blockSize) {
const row = arr.filter((elem) => elem.supposed.y == j);
return [arr, columns, rows];
this.supposed = createVector(x, y);
this.pos = createVector(x, y);
this.vel = createVector(0, 0);
this.acc = createVector(0, 0);
this.seek(this.supposed);
this.seek = (target) => {
let diff = this.pos.copy().sub(target);
let distance = diff.mag();
let f = diff.mult(distance).mult(resiliency);