xxxxxxxxxx
31
let capturer = new CCapture({
frameRate: 60,
format: "webm",
});
let captureLength = 60;
function setup() {
createCanvas(400, 400);
}
function draw() {
//start capturing
if (frameCount == 1) {
capturer.start();
}
//start coding
background(220);
//stop capturing
if (frameCount < captureLength) {
capturer.capture(canvas);
} else if (frameCount === captureLength) {
capturer.save();
capturer.stop();
}
}