This sketch below puts up a video on the upper part of a light blue canvas. When the mouse is pressed, I can draw a line on the canvas but wherevere there is video, the line is not persistent.
let capture;
function setup() {
createCanvas(480, 480);
background(102);
capture = createCapture(VIDEO);
capture.size(320,240);
background(1,186,240,127);
fill(237,340,93,127);
capture.hide();
rectMode(CENTER);
}
function draw() {
image(capture, 0, 0, width, width * capture.height / capture.width);
stroke(255);
if (mouseIsPressed === true) {
line(mouseX, mouseY, pmouseX, pmouseY);
}
}
Is it possible to draw on a video?