xxxxxxxxxx
var capture;
var press;
function setup() {
createCanvas(700, 450);
press=false;
capture = createCapture(VIDEO);
capture.size(width, height);
capture.hide();
}
function draw() {
background(0);
//If the mouse is pressed, invert the colors
image(capture, 0, 0, width, height);
if (press) {
filter('INVERT');
}
filter('POSTERIZE',5);
}
function mousePressed() {
press = !press;
}