xxxxxxxxxx
var scene;
var sceneVid;
var i;
//https://editor.p5js.org/zl102/sketches/9z942B7jk
function preload(){
}
function setup() {
createCanvas(400, 400);
start = createVideo("start.mp4");
fact1 = createVideo("medifact.mp4");
fact2 = createVideo("flowerfact.mp4");
fact3 = createVideo("bushfact.mp4");
fact4 = createVideo("treefact.mp4");
end = createVideo("end.mp4");
start.hide();
fact1.hide();
fact2.hide();
fact3.hide();
fact4.hide();
end.hide();
sceneVid = [start, fact1, fact2, fact3, fact4, end];
i = Math.floor(Math.random()* sceneVid.length);
scene = sceneVid[i];
scene.play();
//scene.loop();
scene.hide();
print(i, scene);
imageMode(CENTER);
}
function draw() {
background(220);
image(scene, 200, 200, 200, 300);
}
function keyPressed(){
if(key == "p"){
//sceneVid.splice(sceneVid, i);
i = Math.floor(Math.random()* sceneVid.length);
}
print(i);
scene = sceneVid[i];
scene.hide();
scene.play();
}