xxxxxxxxxx
let capture
let ii = 0
function setup() {
// function setup
createCanvas(400, 400);
capture = createCapture(
{
audio: false, // NO AUDIO
video: { width: 400, height: 400 },
},
function () {
// creating a function
console.log("capture ready.");
}
);
capture.hide();
noStroke();
fill(50, 250,190);
}
function draw() {
background(88,79,600);
capture.loadPixels()
let stepSize = 3
for (let y = 0; y < height; y += stepSize)
for (let x = 0; x < width; x += stepSize) {
const ii = y * width + x;
const darkness = (240 - capture.pixels[ii * 4]) / 255;
const radius = stepSize * darkness;
rect(x, y, radius, radius);
}
}
if (ii ==1){
background(220,30, 20);
capture.loadPixels()
let stepSize = 3
for (let y = 0; y < height; y += stepSize) {
for (let x = 0; x < width; x += stepSize) {
const ii = y * width + x;
const darkness = (180 - capture.pixels[ii * 4]) / 255;
const radius = stepSize * darkness;
ellipses(x, y, radius, radius);
}
}
}