p5((s) => {
let system, H, W, nfx;
W = form.width;
H = form.height;
s.setup = function () {
s.createCanvas(W, H);
s.background(bg);
s.noStroke();
};
s.draw = function () {
if (!form.freeze) {
s.background(bg);
}
for (let i = 0; i < sq.length; i++) {
s.fill(sq[i].clr);
s.push();
s.translate(sq[i].x, sq[i].y);
nfx = s.noise(sq[i].x * form.nf, sq[i].y * form.nf);
s.rotate(s.TWO_PI * nfx);
s.rect(nfx * form.wave, 0, sq[i].wh * nfx, sq[i].wh);
s.pop();
s.fill(255);
if (form.debug) {
s.text(
"(" + s.round(sq[i].x, 2) + "," + s.round(sq[i].y) + ")",
sq[i].x + sq[i].wh + 2,
nfx * form.wave + sq[i].y
);
}
sq[i].x += form.speed + s.sin(s.frameCount * sq[i].rate);
sq[i].y += s.cos(s.frameCount * sq[i].rate);
if (sq[i].x > W || sq[i].x < 0) {
sq[i].x = 0;
}
}
};
})