xxxxxxxxxx
let capture;
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(30);
capture = createCapture(VIDEO)
capture.size(320,240)
capture.hide()
background(0)
}
function draw() {
image(capture,0,0,160,120)
capture.loadPixels();
let widthRatio = capture.width/ width
let heightRatio = capture.height/height;
for (let i = 0; i<100; i++){
let x = int(random(width))
let y = int(random(height))
let col = capture.get(x*widthRatio,y*heightRatio)
noStroke()
let diameter = map(saturation(col),0,225,1,120)
fill(red(col),green(col),blue(col),128)
ellipse(x,y,diameter)
}
}