xxxxxxxxxx
42
let capture;
let slider;
function setup() {
createCanvas(600, 600);
capture = createCapture(VIDEO);
capture.size(600, 600);
noStroke();
dim = height/4;
colorMode(RGB, 180, 180, 100,50);
ellipseMode(RADIUS);
}
function draw() {
background(255,255,255,10);
ellipse(mouseX, mouseY, 20, 20);
for (var x = 1; x <= width; x+=dim) {
drawGradient(x, height/4);
}
capture.loadPixels();
let size = round(constrain(mouseX/ 8, 6, 32));
for (let y = 0; y < height; y += size) {
for (let x = 0; x < width; x += size) {
let a = y * width + x;
let c = (255 - capture.pixels[a * 4]) / 300;
let s = size * c;
ellipse(x, y, s, s);
}
}
}
function drawGradient(x, y) {
var radius = dim/2;
var h = random(0, 600);
for (r = radius; r > 0; --r) {
fill(h, 90, 90);
h = (h + 1) %180;
}
}