xxxxxxxxxx
34
let amt, startColor, newColor;
let capture;
let c1;
function setup() {
createCanvas(400, 400);
capture = createCapture(VIDEO);
capture.size(width, height);
capture.hide();
startColor = color(255,255,255);
c1 = capture.get (width/2,height/2);
newColor = color (c1[0],c1[1],c1[2]);
background(startColor);
amt = 0;
}
function draw() {
let colorTransition = (lerpColor(startColor, newColor, amt));
amt += 0.002;
if(amt >= 1){
amt = 0.0;
startColor = newColor;
c1 = capture.get (width/2,height/2);
newColor = color (c1[0],c1[1],c1[2]);
}
background (colorTransition);
}