crowds/js/main.js

56 lines
961 B
JavaScript
Raw Normal View History

2018-03-27 17:39:08 +00:00
window.onload = function(){
// Setting up the main stuff
window.slideshow = new Slideshow();
window.pencil = new Pencil();
2018-04-04 15:57:35 +00:00
window.navigation = new Navigation();
2018-03-27 17:39:08 +00:00
// Initializing the Mouse
Mouse.init(document.body);
// Animation loop IS update loop for now, whatever
2018-03-27 17:39:08 +00:00
function update(){
// Update
2018-03-27 17:39:08 +00:00
slideshow.update();
pencil.update();
Mouse.update();
// Draw
2018-03-28 17:12:05 +00:00
slideshow.draw();
pencil.draw();
2018-04-02 17:43:20 +00:00
// Update
publish("update");
2018-03-27 17:39:08 +00:00
window.requestAnimationFrame(update);
2018-03-27 17:39:08 +00:00
}
window.requestAnimationFrame(update);
2018-04-16 15:44:14 +00:00
// Start Preloading!
publish("prepreload");
2018-03-27 17:39:08 +00:00
2018-04-16 15:44:14 +00:00
}
subscribe("START", function(){
// Music
2018-04-18 14:51:44 +00:00
SOUNDS.bg_music.volume(0.5);
SOUNDS.bg_music.loop(true);
2018-04-16 19:51:08 +00:00
SOUNDS.bg_music.play();
2018-04-16 15:44:14 +00:00
2018-04-18 21:00:04 +00:00
// Show Navigation
$("#navigation").style.display = "block";
// Show Skip Button
$("#skip").style.display = "block";
$("#skip").onclick = function(){
2018-04-20 18:47:58 +00:00
publish("sound/button");
2018-04-18 21:00:04 +00:00
slideshow.next();
};
2018-04-16 15:44:14 +00:00
// Introduction
slideshow.next();
});