xxxxxxxxxx
36
let capture;
let offset = 0.0;
let captureWidth = 640;
let captureHeight = 480;
function setup() {
createCanvas(windowWidth, windowHeight);
capture = createCapture(VIDEO);
capture.size(captureWidth, captureHeight);
capture.hide();
noStroke();
}
function draw() {
let r = 255 * noise(offset+0);
let g = 255 * noise(offset+5);
let b = 255 * noise(offset+10);
background(255);
//fill(r, g, b);
capture.loadPixels();
const stepSize = round(constrain(mouseX / 8, 6, 32));
for (let y = 0; y < captureHeight; y += stepSize) {
for (let x = 0; x < captureWidth; x += stepSize) {
const i = y * captureWidth + x;
const darkness = (255 - capture.pixels[i * 4]) / 255;
const radius = stepSize * darkness;
ellipse(x, y, radius, radius * map(noise(offset), 0, 1, 0, 15), 0, 1, 0, 2);
}
}
offset += 0.01;
}