xxxxxxxxxx
28
function setup() {
createCanvas(400, 400);
pixelDensity(1);
}
function draw() {
background(51);
loadPixels();
for (let y=0; y<height; y++){
for (let x=0; x<width/2; x++){
let index = (x+y*width)*4;
pixels[index + 0] = mouseX;
pixels[index + 1] = random(255);
pixels[index + 2] = y;
pixels[index + 3] = random(255);
}
for (let x=0; x<(width/2+width/2); x++){
let index = (x+y*width)*4;
pixels[index + 0] = mouseX;
pixels[index + 1] = (mouseX+mouseY)/2;
pixels[index + 2] = mouseY;
pixels[index + 3] = 100;
}
}
updatePixels();
}