xxxxxxxxxx
36
let size = {
width: 320, height: 240
};
let capture;
let x = 0;
let img;
let pos;
let loaded = false;
let side = 32;
function setup() {
capture = createCapture(VIDEO);
capture.size(size.width, size.height);
createCanvas(size.width, size.height);
background(220);
}
function draw() {
capture.loadPixels();
for (let x = 0; x < capture.width; x += side) {
for(let y = 0; y < capture.height; y += side) {
let index = (y * capture.width + x) * 4;
let r = capture.pixels[index];
let g = capture.pixels[index+1];
let b = capture.pixels[index+2];
noStroke();
fill(r, g, b);
ellipse(x + side/2, y + side/2, side, side);
}
}
}