xxxxxxxxxx
22
let video;
let button;
function setup() {
createCanvas(windowWidth, windowHeight);
//background(51);
video = createCapture(VIDEO); //access live webcam
video.hide();
//button = createButton('snap'); //create a button called "snap"
//button.mousePressed(takesnap); //when the button is pressed, call the function called "takesnap"
}
function mousePressed() {
image(video, 0, 0, width, video.height*width/video.width); //draw the image being captured on webcam onto the canvas at the position (0, 0) of the canvas
}