xxxxxxxxxx
41
let vid;
let vid2;
let cnv;
let positions = [];
let button;
function setup() {
cnv = createCanvas(600, 400);
vid1 = createVideo("./assets/cut1.mp4");
vid2 = createVideo("./assets/cut2.mp4");
button = createButton("play");
button.mousePressed(togglePlaying);
vid1.hide();
vid2.hide();
}
function togglePlaying() {
vid1.loop();
vid1.volume(0);
vid2.loop();
vid2.volume(0);
}
function draw() {
vid1.loadPixels();
image(vid2, 0, 0);
positions.push({ x: mouseX, y: mouseY });
noStroke();
fill(0); // need to fill using pixels from vid1
for (let i = 0; i < positions.length; i++) {
let x = positions[i].x;
let y = positions[i].y;
ellipse(x, y, 80, 80);
}
}