function draw(p) {
let count = 127;
return () => {
count += 1;
if (count == 255) {
count = 127;
}
mutable Output = p.frameCount;
p.background(255);
p.loadPixels();
for (var y = 0; y < p.height; y++) {
for (var x = 0; x < p.width; x++) {
var index = (x + y * p.width) * 4;
if (x < y && x % 16 != 0) {
p.pixels[index + 0] = (2 * x) % count;
p.pixels[index + 1] = (3 * y) % count;
p.pixels[index + 2] = 2 * count;
} else {
p.pixels[index + 0] = 127 % count;
p.pixels[index + 1] = 0;
p.pixels[index + 2] = 0;
}
p.pixels[index + 3] = 255;
}
}
p.updatePixels();
};
}