xxxxxxxxxx
29
function setup() {
createCanvas(800,800);
rectMode(CENTER);
noStroke();
frameRate(2);
capture = createCapture(VIDEO);
//capture.hide();
}
function draw() {
//background(230,30,23);
var c1= capture.get (width/2,height/2);
var c2= capture.get (200,200);
let gradient = drawingContext.createLinearGradient(
width/2-200, height/2-200, width/2+200, height/2+200 );
gradient.addColorStop(0,color(c1[0],c1[1],c1[2]));
gradient.addColorStop(1,color(c2[0],c2[1],c2[2]));
drawingContext.fillStyle = gradient;
rect (width/2,height/2, width, height);
}