xxxxxxxxxx
39
let n, side;
let radius, noiseRadius;
let numFrames;
let xb, yb;
function setup() {
n = 30;
radius = 150;
noiseRadius = 2;
numFrames = 120;
createCanvas(400, 400);
noFill();
side = width / n;
}
function draw() {
background(0);
let t = map(frameCount-1, 0, numFrames, 0, 1);
// stroke(255);
xb = width/2 * noise(0, noiseRadius*cos(TWO_PI*t), noiseRadius*sin(TWO_PI*t))+width/2;
yb = height/2 * noise(10000, noiseRadius*cos(TWO_PI*t), noiseRadius*sin(TWO_PI*t))+height/2;
for (let y = 0; y < n; y++) {
for (let x = 0; x < n; x++) {
radius = 100 * noise(x*side*0.01, y*side*0.01, noiseRadius*cos(TWO_PI*t), noiseRadius*sin(TWO_PI*t)) + 100;
if (dist(x*side, y*side, xb, yb) < radius) {
stroke(color(random(255), random(255), random(255)));
line(x*side, y*side, (x+1)*side, (y+1)*side);
} else {
stroke(255);
line((x+1)*side, y*side, x*side, (y+1)*side);
}
}
}
}