xxxxxxxxxx
106
let playing = false;
let fingers;
let button;
function preload() {
song1 = loadSound('einde.mp3');
myFont = loadFont('AlteHaasGroteskRegular.ttf');
hoeklijnen = loadImage ('hoeklijnenregelm2klein.png');
confetti = loadImage ('confettikleur.png');
ster1 = loadImage ('ster1kleur.png');
ster2 = loadImage ('ster2kleur.png');
slinger1 = loadImage ('slinger1kleur.png');
slinger2 = loadImage ('slinger2kleur.png');
}
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(['eindegeler.mp4']);
fingers.size (windowWidth/2.04, windowWidth/2.74);
fingers.position (windowWidth/2-windowWidth/4.08,windowHeight/4.5-windowWidth/8);
image(hoeklijnen, windowWidth/4000,windowHeight/900,windowWidth/20, windowWidth/20);
image(confetti,windowWidth/10,windowHeight/10,windowWidth/1.2, windowWidth/3.6);
image(slinger1, windowWidth/20, windowWidth/10, windowWidth/80,windowWidth/10);
image(slinger2, windowWidth/1.08, windowWidth/2.5, windowWidth/80,windowWidth/10);
image(ster1, windowWidth/16, windowWidth/2.4, windowWidth/20,windowWidth/20);
image(ster2, windowWidth/1.12, windowWidth/20, windowWidth/15,windowWidth/15);
s2 = 'Goed gedaan! Je hebt geleerd over bedjes, een bedje versierd, een mooie tekening gemaakt, heel stil geweest en de baby veel liefde gegeven! Je bent klaar om op bezoek te gaan!' ;
fill(255,255,255);
textSize(windowWidth/40);
textFont(myFont);
textAlign(CENTER)
text(s2,windowWidth/2-windowWidth/2.8,windowHeight/1.2-windowWidth/9, windowWidth/1.41, windowHeight);
//button = createImg('playvideo.png');
//button.size(windowWidth/2.04, windowWidth/2.74);
//button.position(windowWidth/2-windowWidth/4.08,windowHeight/4.5-windowWidth/8);
//button.mousePressed(toggleVid);
button = createImg('knopterug.png');
button.size(windowWidth/7.9,windowWidth/15);
button.position(windowWidth/2-windowWidth/3.95,windowHeight/1.2);
button.mousePressed(changeBH);
button = createImg('knopplay.png');
button.size(windowWidth/7.9,windowWidth/15);
button.position(windowWidth/2-windowWidth/15.8,windowHeight/1.2);
button.mousePressed(toggleVid);
button = createImg('knopluidspreker.png');
button.size(windowWidth/7.9,windowWidth/15);
button.position(windowWidth/2+windowWidth/7.9,windowHeight/1.2);
button.mousePressed(changeBI);
}
function toggleVid() {
if (playing) {
fingers.pause();
button = createImg('knopplay.png');
button.size(windowWidth/7.9,windowWidth/15);
button.position(windowWidth/2-windowWidth/15.8,windowHeight/1.2);
button.mousePressed(toggleVid);
} else {
fingers = createVideo(['eindegeler.mp4']);
fingers.size (windowWidth/2.04, windowWidth/2.74);
fingers.position (windowWidth/2-windowWidth/4.08,windowHeight/4.5-windowWidth/8);
fingers.play();
button = createImg('stopknop.png');
button.size(windowWidth/7.9,windowWidth/15);
button.position(windowWidth/2-windowWidth/15.8,windowHeight/1.2);
button.mousePressed(toggleVid);
}
playing = !playing;
}
function changeBH() {
window.open("https://editor.p5js.org/Rose_Thys/present/1qyKCb0Tk", "_self").close();
}
function changeBI() {
if (song1.isPlaying()) {
song1.stop();
} else {
song1.play();
}
}