xxxxxxxxxx
27
function setup() {
createCanvas(200, 200);
pixelDensity(1);
}
function draw() {
loadPixels();
let pixelIndex,
brightness,
xOffset,
yOffset = 0;
for (let x = 0; x < width; x++) {
xOffset = 0;
for (let y = 0; y < height; y++) {
pixelIndex = (x + y * width) * 4;
brightness = noise(xOffset, yOffset) * 255;
pixels[pixelIndex] = brightness;
pixels[pixelIndex + 1] = brightness;
pixels[pixelIndex + 2] = brightness;
pixels[pixelIndex + 3] = 255;
xOffset += 0.05;
}
yOffset += 0.05;
}
updatePixels();
}