vid;
let alte = 600;
let largh = 320;
let filtro = false; // Boleana per accendere e spegnere filtri
function setup() {
createCanvas(largh, alte);
vid = createVideo(“assets/tennis.mp4”, vidLoad);
vid.size(largh, alte);
vid.hide();
}
function draw() {
background(220);
image(vid, 0, 0, largh, alte); // inserisci video nel canvas
if (filtro) {
filter(POSTERIZE, 5);
}
//play/pause
if (keyIsPressed && key == ‘s’)
vid.pause();
if (keyIsPressed && key == ‘p’)
vid.play();
if (keyIsPressed && key == ‘ ‘)
vid.time(5.6); // momento in cui colpisce la pallina
}
// Attiva/disattiva il filtro al click del mouse
function mousePressed() {
filtro = !filtro;
}
function vidLoad(){
vid.loop();
vid.volume(0);
}

Lascia un commento
Devi essere connesso per inviare un commento.