xxxxxxxxxx
41
let radius, numX, spacingX, numY, spacingY;
function setup() {
createCanvas(400, 400);
fill(0);
/* if you're on a Mac with a retina screen,
* pixel density is 2 and then this library
* generates a gif at TWICE the size your canvas is
* so we preemptively set it 1 for all systems
*/
pixelDensity(1);
radius = height / 10;
numX = 20;
spacingX = width / numX;
numY = 20;
spacingY = width / numX;
noStroke();
createLoop({
duration: 3,
gif: true,
noise: {
radius: 0.2,
seed: 99
}
});
}
function draw() {
background(255);
for (var x = 0; x < numX; x++) {
for(var y = 0; y < numY; y++){
const scl = animLoop.noise2D(x, y);
fill(0.5 * (scl + 1) * 255);
rect(x * spacingX, y * spacingY, spacingX, spacingY);
}
}
}