diff --git a/pulsar/assets/js/audience/audience-app.js b/pulsar/assets/js/audience/audience-app.js index a83251f..83eb301 100644 --- a/pulsar/assets/js/audience/audience-app.js +++ b/pulsar/assets/js/audience/audience-app.js @@ -43,13 +43,8 @@ new p5(p => { let maxStrobe = 0; let strobe = 0; - const instrumentMap = [ - "bass/synth", - "drums", - "percussion", - "horns", - "melody" - ]; + const instrumentMap = ["bass", "drums", "percussion", "horns", "melody"]; + let countdown; let instrumentDrawings = [[], [], [], [], []]; channel.on( @@ -80,6 +75,8 @@ new p5(p => { maxStrobe = size; } else if (type === "autostrobe") { autostrobe = value; + } else if (type === "countdown") { + countdown = value; } else if (type === "instrument") { instrumentDrawings[recievedInstrument].push({ x: x * p.width, @@ -288,7 +285,14 @@ new p5(p => { strobe--; } - // Fireflys + if (countdown >= 1) { + p.fill(150, 150, 150, 255 * (countdown / 10)); + p.textSize(p.width / 10); + p.text(countdown, widthPc(5), p.height - heightPc(5)); + } + p.textSize(12); + + // Fireflys; drawFirefly(); drawInstruments(); diff --git a/pulsar/assets/js/slides/slides.js b/pulsar/assets/js/slides/slides.js index 13e3274..b3acf4e 100644 --- a/pulsar/assets/js/slides/slides.js +++ b/pulsar/assets/js/slides/slides.js @@ -28,6 +28,8 @@ Reveal.initialize({ let socket = new Socket("/socket", { params: { token: window.userToken } }); socket.connect(); let slidesChannel = socket.channel("slides:lobby", {}); +let pulseChannel = socket.channel("audience:lobby", {}); + slidesChannel .join() .receive("ok", resp => { @@ -37,6 +39,24 @@ slidesChannel console.log("Unable to join", resp); }); +pulseChannel + .join() + .receive("ok", resp => { + console.log("Joined audience successfully", resp); + }) + .receive("error", resp => { + console.log("Unable to join", resp); + }); + slidesChannel.on("slides", ({ action }) => { Reveal[action](); }); + +Reveal.addEventListener("slidechanged", function(event) { + console.log(Reveal.getTotalSlides() - event.indexh - 1); + pulseChannel.push("pulse", { + type: "countdown", + value: Reveal.getTotalSlides() - event.indexh - 1 + }); + // event.previousSlide, event.currentSlide, event.indexh, event.indexv +}); diff --git a/pulsar/lib/pulsar_web/templates/slides/index.html.eex b/pulsar/lib/pulsar_web/templates/slides/index.html.eex index 5c7c388..b487cda 100644 --- a/pulsar/lib/pulsar_web/templates/slides/index.html.eex +++ b/pulsar/lib/pulsar_web/templates/slides/index.html.eex @@ -25,24 +25,24 @@
-
+

http://pulsar.wtf

Outsourced
VJ-ing

Sputnik (@dermah)
-
+

http://pulsar.wtf

Sputnik (@dermah)
-
+

http://pulsar.wtf

Sputnik (@dermah)
-
+

http://pulsar.wtf

Outsourced
VJ-ing

@@ -51,21 +51,21 @@
-
+
-
+
-
+
-
+