xxxxxxxxxx
22
const roughness = 4;
function setup() {
createCanvas(400, 400);
noiseSeed(50);
}
function draw() {
background(255);
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y++) {
let n = noise(roughness * x / width, roughness * y / height);
//n = n < 0.5 ? 0 : 255;
n = 255 * 0.5 * (Math.tanh((n - 0.5) * 30) + 1);
noStroke();
fill(n);
rect(x, y, 1, 1);
}
}
noLoop();
}