xxxxxxxxxx
25
let video;
function setup() {
createCanvas(400, 400);
video = createCapture(VIDEO);
video.size(width, height);
}
function draw() {
background(220);
image(video, 0, 0);
loadPixels();
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y++) {
if (random(0,10) < 2) {
set(x,y,color(random(0, 255), random(0, 255), random(0, 255)))
}
}
}
updatePixels();
for (let i = 0; i < 10; i++) {
fill(random(0, 255), random(0, 255), random(0, 255));
rect(random(0, width), random(0, height), random(0, 200), random(0, 200))
}
}