xxxxxxxxxx
86
let playing = false;
let fingers;
let button;
function preload() {
myFont = loadFont('AlteHaasGroteskRegular.ttf');
song1 = loadSound('speelhetspel.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
background (253, 196, 56);
// specify multiple formats for different browsers
//fingers = createVideo(['assets/fingers.mov', 'assets/fingers.webm']);
fingers = createVideo(['Intro2.mp4']);
fingers.size (windowWidth/1.85, windowWidth/2.49);
fingers.position (windowWidth/2-windowWidth/3.7,windowHeight/4.5-windowWidth/8);
s2 = 'Speel het spel!';
fill(255,255,255);
textSize(windowWidth/40);
textFont(myFont);
//textAlign(CENTER)
text(s2,windowWidth/2-windowWidth/12,windowHeight/1.2-windowWidth/25, windowWidth/1.2, windowHeight);
button = createImg('doorzichtig.png');
button.size(windowWidth/6,windowWidth/30);
button.position(windowWidth/2-windowWidth/12,windowHeight/1.2-windowWidth/25);
button.mousePressed(changeBK);
button = createImg('playvideo.png');
button.size(windowWidth/1.85, windowWidth/2.49);
button.position(windowWidth/2-windowWidth/3.7,windowHeight/4.5-windowWidth/8);
button.mousePressed(toggleVid);
button = createImg('knopplay.png');
button.size(windowWidth/7.9,windowWidth/15);
button.position(windowWidth/2-windowWidth/15.8,windowHeight/1.2);
button.mousePressed(changeBJ);
}
function toggleVid() {
if (playing) {
fingers.pause();
button = createImg('playvideo.png');
button.size(windowWidth/1.85, windowWidth/2.49);
button.position(windowWidth/2-windowWidth/3.7,windowHeight/4.5-windowWidth/8);
button.mousePressed(toggleVid);
} else {
fingers = createVideo(['Intro2.mp4']);
fingers.size (windowWidth/1.85, windowWidth/2.49);
fingers.position (windowWidth/2-windowWidth/3.7,windowHeight/4.5-windowWidth/8);
fingers.play();
button = createImg('doorzichtig.png');
button.size(windowWidth/1.85, windowWidth/2.49);
button.position(windowWidth/2-windowWidth/3.7,windowHeight/4.5-windowWidth/8);
button.mousePressed(toggleVid);
}
playing = !playing;
}
function changeBJ() {
window.open("https://sketchfab.com/models/c9cd4be644ff466ba61e38168c863be6/embed");
window.open("https://editor.p5js.org/Rose_Thys/present/xd_o2RP9g", "_self").close();
}
function changeBK() {
song1.play();
}