xxxxxxxxxx
37
let radius, numX, spacingX;
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 = 80;
spacingX = width / numX;
noFill();
createLoop({
duration: 3,
gif: true,
noise: {
radius: 0.1,
seed: 99
}
});
}
function draw() {
background(255);
beginShape();
for (var x = 0; x < numX; x++) {
const scl = animLoop.noise1D(x) * radius;
vertex(x * spacingX, scl + height / 2);
}
endShape();
}